forked from pool/python-python-jenkins
* Fix compatibility with setuptools >= 66 * get_build_artifact_as_bytes to support non-json files * Handle 'all' view name when requested 'All' * WrappedSession: Fix URL to requests issue 3829 * support urllib3 newer DEFAULT_TIMEOUT * Use multiprocess to avoid pickle errors in tox on macos - Dropped patch use-parts-of-legacy-version.patch: * Merged upstream. - Refreshed patch python-python-jenkins-no-mock.patch: * It was submitted upstream. - Add patch remove-six.patch: * Remove usage of six. - Remove pin against urllib3. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-jenkins?expand=0&rev=40
198 lines
6.5 KiB
Diff
198 lines
6.5 KiB
Diff
From 63b657fe23c3b33903061a17b88787886be3c6dd Mon Sep 17 00:00:00 2001
|
|
From: Alexandre Detiste <alexandre.detiste@gmail.com>
|
|
Date: Sat, 11 Jan 2025 14:55:46 +0100
|
|
Subject: [PATCH] remove Python2 & six
|
|
|
|
Change-Id: I4b64b01d607446a7aa8cbe2070b97717ed6267b5
|
|
---
|
|
jenkins/__init__.py | 6 +++---
|
|
requirements.txt | 1 -
|
|
setup.cfg | 8 +++++---
|
|
test-requirements.txt | 1 -
|
|
tests/base.py | 9 ++-------
|
|
tests/helper.py | 4 ++--
|
|
tests/jobs/test_build.py | 4 ++--
|
|
tests/test_jenkins.py | 11 +++++------
|
|
tests/test_jenkins_sockets.py | 3 ++-
|
|
tests/test_promotion.py | 5 ++---
|
|
10 files changed, 23 insertions(+), 29 deletions(-)
|
|
|
|
Index: python-jenkins-1.8.2/jenkins/__init__.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/jenkins/__init__.py
|
|
+++ python-jenkins-1.8.2/jenkins/__init__.py
|
|
@@ -59,9 +59,9 @@ import requests
|
|
import requests.exceptions as req_exc
|
|
import urllib3.util.timeout
|
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|
-from six.moves.http_client import BadStatusLine
|
|
-from six.moves.urllib.error import URLError
|
|
-from six.moves.urllib.parse import quote, urlencode, urljoin, urlparse
|
|
+from http.client import BadStatusLine
|
|
+from urllib.error import URLError
|
|
+from urllib.parse import quote, urlencode, urljoin, urlparse
|
|
import xml.etree.ElementTree as ET
|
|
|
|
from jenkins import plugins
|
|
Index: python-jenkins-1.8.2/requirements.txt
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/requirements.txt
|
|
+++ python-jenkins-1.8.2/requirements.txt
|
|
@@ -1,4 +1,3 @@
|
|
-six>=1.3.0
|
|
pbr>=0.8.2
|
|
multi_key_dict
|
|
requests
|
|
Index: python-jenkins-1.8.2/setup.cfg
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/setup.cfg
|
|
+++ python-jenkins-1.8.2/setup.cfg
|
|
@@ -19,12 +19,14 @@ classifier =
|
|
License :: OSI Approved :: BSD License
|
|
Operating System :: OS Independent
|
|
Programming Language :: Python
|
|
- Programming Language :: Python :: 2
|
|
- Programming Language :: Python :: 2.7
|
|
Programming Language :: Python :: 3
|
|
- Programming Language :: Python :: 3.4
|
|
Programming Language :: Python :: 3.5
|
|
Programming Language :: Python :: 3.6
|
|
+ Programming Language :: Python :: 3.7
|
|
+ Programming Language :: Python :: 3.8
|
|
+ Programming Language :: Python :: 3.9
|
|
+ Programming Language :: Python :: 3.10
|
|
+ Programming Language :: Python :: 3.11
|
|
|
|
[files]
|
|
packages =
|
|
Index: python-jenkins-1.8.2/test-requirements.txt
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/test-requirements.txt
|
|
+++ python-jenkins-1.8.2/test-requirements.txt
|
|
@@ -1,7 +1,6 @@
|
|
cmd2!=0.8.3,<0.9.0;python_version<'3.0' # MIT
|
|
cmd2!=0.8.3;python_version>='3.0' # MIT
|
|
coverage>=3.6
|
|
-unittest2
|
|
python-subunit
|
|
requests-mock>=1.11.0
|
|
requests-kerberos<=0.12.0;python_version<'3.6'
|
|
Index: python-jenkins-1.8.2/tests/base.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/base.py
|
|
+++ python-jenkins-1.8.2/tests/base.py
|
|
@@ -1,15 +1,10 @@
|
|
-import sys
|
|
+import unittest
|
|
+from unittest import mock
|
|
|
|
-import mock
|
|
from testscenarios import TestWithScenarios
|
|
|
|
import jenkins
|
|
|
|
-if sys.version_info < (2, 7):
|
|
- import unittest2 as unittest
|
|
-else:
|
|
- import unittest
|
|
-
|
|
|
|
class JenkinsTestBase(TestWithScenarios, unittest.TestCase):
|
|
|
|
Index: python-jenkins-1.8.2/tests/helper.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/helper.py
|
|
+++ python-jenkins-1.8.2/tests/helper.py
|
|
@@ -2,11 +2,11 @@ import functools
|
|
import json
|
|
from multiprocess import Process
|
|
from multiprocess import Queue
|
|
+import socketserver
|
|
import traceback
|
|
+from unittest.mock import Mock
|
|
|
|
-from mock import Mock
|
|
import requests
|
|
-from six.moves import socketserver
|
|
|
|
|
|
class TestsTimeoutException(Exception):
|
|
Index: python-jenkins-1.8.2/tests/jobs/test_build.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/jobs/test_build.py
|
|
+++ python-jenkins-1.8.2/tests/jobs/test_build.py
|
|
@@ -1,8 +1,8 @@
|
|
# -*- coding: utf-8 -*-
|
|
-from mock import patch
|
|
+from unittest.mock import patch
|
|
+from urllib.parse import quote
|
|
|
|
import jenkins
|
|
-from six.moves.urllib.parse import quote
|
|
from tests.helper import build_response_mock
|
|
from tests.jobs.base import JenkinsJobsTestBase
|
|
|
|
Index: python-jenkins-1.8.2/tests/test_jenkins.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/test_jenkins.py
|
|
+++ python-jenkins-1.8.2/tests/test_jenkins.py
|
|
@@ -1,7 +1,6 @@
|
|
import json
|
|
-
|
|
-from mock import patch
|
|
-import six
|
|
+import io
|
|
+from unittest.mock import patch
|
|
|
|
from tests.base import JenkinsTestBase
|
|
from tests.helper import build_response_mock
|
|
@@ -12,7 +11,7 @@ import jenkins
|
|
def get_mock_urlopen_return_value(a_dict=None):
|
|
if a_dict is None:
|
|
a_dict = {}
|
|
- return six.BytesIO(json.dumps(a_dict).encode('utf-8'))
|
|
+ return io.BytesIO(json.dumps(a_dict).encode('utf-8'))
|
|
|
|
|
|
class JenkinsConstructorTest(JenkinsTestBase):
|
|
@@ -45,8 +44,8 @@ class JenkinsConstructorTest(JenkinsTest
|
|
|
|
def test_unicode_password(self):
|
|
j = jenkins.Jenkins('{0}'.format(self.base_url),
|
|
- six.u('nonascii'),
|
|
- six.u('\xe9\u20ac'))
|
|
+ 'nonascii',
|
|
+ '\xe9\u20ac')
|
|
j._maybe_add_auth()
|
|
self.assertEqual(j.server, self.make_url(''))
|
|
self.assertEqual(j.auth(self.req).headers['Authorization'],
|
|
Index: python-jenkins-1.8.2/tests/test_jenkins_sockets.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/test_jenkins_sockets.py
|
|
+++ python-jenkins-1.8.2/tests/test_jenkins_sockets.py
|
|
@@ -1,4 +1,5 @@
|
|
-from six.moves import StringIO
|
|
+from io import StringIO
|
|
+
|
|
import testtools
|
|
from testtools.content import text_content
|
|
|
|
Index: python-jenkins-1.8.2/tests/test_promotion.py
|
|
===================================================================
|
|
--- python-jenkins-1.8.2.orig/tests/test_promotion.py
|
|
+++ python-jenkins-1.8.2/tests/test_promotion.py
|
|
@@ -1,11 +1,10 @@
|
|
import json
|
|
-from mock import patch
|
|
+from unittest.mock import patch
|
|
+from urllib.error import HTTPError
|
|
|
|
import jenkins
|
|
from tests.base import JenkinsTestBase
|
|
|
|
-from six.moves.urllib.error import HTTPError
|
|
-
|
|
|
|
class JenkinsPromotionsTestBase(JenkinsTestBase):
|
|
config_xml = """<hudson.plugins.promoted__builds.PromotionProcess>
|