summaryrefslogtreecommitdiff
path: root/dev-python/requests-toolbelt
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
commit7bc9c63c9da678a7e6fceb095d56c634afd22c56 (patch)
tree4a67d50a439e9af63947e5f8b6ba3719af98b6c9 /dev-python/requests-toolbelt
parentb284a3168fa91a038925d2ecf5e4791011ea5e7d (diff)
gentoo resync : 15.12.2019
Diffstat (limited to 'dev-python/requests-toolbelt')
-rw-r--r--dev-python/requests-toolbelt/Manifest5
-rw-r--r--dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-internet.patch28
-rw-r--r--dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-py2.patch68
-rw-r--r--dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests.patch128
-rw-r--r--dev-python/requests-toolbelt/requests-toolbelt-0.9.1.ebuild25
5 files changed, 241 insertions, 13 deletions
diff --git a/dev-python/requests-toolbelt/Manifest b/dev-python/requests-toolbelt/Manifest
index 69a66f0e05be..a948802d643e 100644
--- a/dev-python/requests-toolbelt/Manifest
+++ b/dev-python/requests-toolbelt/Manifest
@@ -1,6 +1,9 @@
AUX requests-toolbelt-0.8.0-test-tracebacks.patch 1428 BLAKE2B 6f9645f2a456cde3a080337c00697493958d9bfd424eef9b9998233336ccea06ecea345cd55ff1321939421bbbb5c7ea566de8ed3d5d8133d62083c80f2bc2a6 SHA512 22332dceb704750d1d6ca7d640251dacea764dbbda4e530977f6788e19c1d1a857471d8cd94d99465e146bc96be9c35b67a9608a31997725b6284e7c10117f8f
+AUX requests-toolbelt-0.9.1-tests-internet.patch 1225 BLAKE2B 54af195690d8ac475453029f51ff1d6040512dbccee6e24b3d0827e535f7ee1c5fb536abfe66c75dfb31837ffefbf23adeba6ad14c36c56585993b31d9480217 SHA512 3226755d227eeb685eac5fa68ae86fa057d852b682ee3f0607f775bd33230d85afdb7a0c466bb3c5eff5adf256a7895cfd6ad752fefdec95a4684e5cddda0410
+AUX requests-toolbelt-0.9.1-tests-py2.patch 3100 BLAKE2B 39ecfd8f0bbf2a4d0731c485ada404f405413117e7451d36eefbc4f05b0073f86310e66ad4320e8ce648175aa072306acab551a50a4a516470b0beb4b981124a SHA512 540813a2d69c84d37a4a6ec5b98d2b71693ba34bbf661bb44be69c646d164134702e9fadd341d07085205b476239260167c858983978488553a07bdbf205ba24
+AUX requests-toolbelt-0.9.1-tests.patch 5781 BLAKE2B ff7339a1daf0ba2df49914847000f0b8b5ff2d097a59bcb02bcb2b20a885f18223a1da1f44a99d846dcff423239108411c193da5092bbb27fdf50bf211dd59f7 SHA512 86919154164274efe8bceb42eb9fc17524d4e144a541e82bc10692da66e533220cdc7186362d77fd4f3acdc639744cdf5273c2e4e2091eb4d33c1fdc6c631ec5
DIST requests-toolbelt-0.8.0.tar.gz 196129 BLAKE2B 435059ff2879c44a274641c49adae9986c761fcabe567826454d3f055db7e3e5c95905f1d178dcb37e2173bf856a9fb168a856c1301026e8c5d0de6cafb4be51 SHA512 71a4ed8961b742cb1b5b0deec7f9052a2a177d2ed6e4f13ebe22b56b7f1b6b1bad2736f1640c8b41398b082eddc1c1205f0c446602d979d5bf370fb0e10ecc88
DIST requests-toolbelt-0.9.1.tar.gz 207286 BLAKE2B 6123677a9abafebddf7dffde2150b2426b5132ebe0c330ff891322ecc3d69232a5b15a0c66e3e1fb4832dc04f5a636a939613fba041e499e9fbca9814f548c7e SHA512 12229928df5df71cb57bc65ef453dc0e4a2bbe190c1579811b2c2823673bd81aeba856b00000fa20b253d0f0fa4fff55ea1e750794ca3785f71c376b1df7fd93
EBUILD requests-toolbelt-0.8.0.ebuild 1042 BLAKE2B 7f94fcd22dea93322e3faa641fb54e0e4856191894912b8387806dacaa12386f338a257aba012c5a084fdd3a5738fd28f732c795346b4f0a5e7409d170ef4f14 SHA512 618f44f24bad2cffe25c3ded828593d9ede70edae37d83f60e38ea5c1ab48ea75610e23d0825e2532c497559d9a02534f2687f80886995f024908b858affa1b7
-EBUILD requests-toolbelt-0.9.1.ebuild 1046 BLAKE2B 9312673e283d3156fef105c3adf896904316feab4e17f6dfa13d79273e95af56bb4f05161940b3adf7d4612f2e48fe0fe21197f80053a51bc8efb53cc04706b4 SHA512 528455e866384167a1223d32a3ae0101c979b28cc44c85305cec655f19c19e9fdfbaf23ed485e88f13fb8cda2f449dbaf65fa39f8f539fc0a51d9578163cef8b
+EBUILD requests-toolbelt-0.9.1.ebuild 1168 BLAKE2B c4d3cd1d32249eeb1615ef9dc92661e4f9650e264bfd7b6f21273ff6eddc295108b31d8dbf86a30cf76ed888a473a86284fe4f06aa3684c146982b66a20f6797 SHA512 1ae2fb022cd046d85deb6e2a842d3b625383f609d5199da9c880ff8c2154295e4e87a549d4f68db8b69b2905bb7705302be1959fb0ed9de71ec9ea8151136854
MISC metadata.xml 297 BLAKE2B 0dbab9c3d9697a1ac5ab03c7111a1862d977546c23cf42967669a6e3a19eff6e81b2a0701cfc2e11904c220026a5bc7b19934cca17339ab7f9037891ab5b2c8f SHA512 46897583f3474724b466e1d1a6b5e0d4c4d557730ce38c809ac2224d2b1dec3e844c0b66b7b6d9f5e60f82cd51a791c1a3ddf545d9898d70038ea2af183a8691
diff --git a/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-internet.patch b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-internet.patch
new file mode 100644
index 000000000000..b3dc2603c117
--- /dev/null
+++ b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-internet.patch
@@ -0,0 +1,28 @@
+diff --git a/tests/test_multipart_encoder.py b/tests/test_multipart_encoder.py
+index 575f54c..73a880e 100644
+--- a/tests/test_multipart_encoder.py
++++ b/tests/test_multipart_encoder.py
+@@ -94,6 +94,7 @@ class TestFileFromURLWrapper(unittest.TestCase):
+ s = requests.Session()
+ self.recorder = get_betamax(s)
+
++ @unittest.skip("test requires internet access")
+ def test_read_file(self):
+ url = ('https://stxnext.com/static/img/logo.830ebe551641.svg')
+ with self.recorder.use_cassette(
+@@ -110,6 +111,7 @@ class TestFileFromURLWrapper(unittest.TestCase):
+ assert chunk == b'ww.w3.org/'
+ assert self.instance.len == 5147
+
++ @unittest.skip("test requires internet access")
+ def test_no_content_length_header(self):
+ url = (
+ 'https://api.github.com/repos/sigmavirus24/github3.py/releases/'
+@@ -191,6 +193,7 @@ class TestMultipartEncoder(unittest.TestCase):
+ m = MultipartEncoder([('field', 'foo'), ('file', fd)])
+ assert m.read() is not None
+
++ @unittest.skip("test requires internet access")
+ def test_reads_file_from_url_wrapper(self):
+ s = requests.Session()
+ recorder = get_betamax(s)
diff --git a/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-py2.patch b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-py2.patch
new file mode 100644
index 000000000000..6825c5f4ed4c
--- /dev/null
+++ b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests-py2.patch
@@ -0,0 +1,68 @@
+diff --git a/tests/threaded/test_pool.py b/tests/threaded/test_pool.py
+index 3e54b3c..9583c7b 100644
+--- a/tests/threaded/test_pool.py
++++ b/tests/threaded/test_pool.py
+@@ -5,6 +5,7 @@ except ImportError:
+ import Queue as queue
+ import unittest
+
++import sys
+ import mock
+ import pytest
+
+@@ -60,6 +61,7 @@ class TestPool(unittest.TestCase):
+ assert session.called is True
+ session.assert_called_once_with()
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_from_exceptions_populates_a_queue(self):
+ """Ensure a Queue is properly populated from exceptions."""
+ urls = ["https://httpbin.org/get?n={}".format(n) for n in range(5)]
+@@ -77,6 +79,7 @@ class TestPool(unittest.TestCase):
+ for url in urls
+ ]
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_from_urls_constructs_get_requests(self):
+ """Ensure a Queue is properly populated from an iterable of urls."""
+ urls = ["https://httpbin.org/get?n={}".format(n) for n in range(5)]
+@@ -92,6 +95,7 @@ class TestPool(unittest.TestCase):
+ for url in urls
+ ]
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_from_urls_constructs_get_requests_with_kwargs(self):
+ """Ensure a Queue is properly populated from an iterable of urls."""
+ def merge(*args):
+@@ -130,6 +134,7 @@ class TestPool(unittest.TestCase):
+ for st in session_threads:
+ st.join.assert_called_once_with()
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_get_response_returns_thread_response(self):
+ """Ensure that a ThreadResponse is made when there's data."""
+ queues = []
+@@ -149,6 +154,7 @@ class TestPool(unittest.TestCase):
+ assert isinstance(p.get_response(), pool.ThreadResponse)
+ assert len([q for q in queues if q.get_nowait.called]) == 1
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_get_exception_returns_thread_exception(self):
+ """Ensure that a ThreadException is made when there's data."""
+ queues = []
+@@ -168,6 +174,7 @@ class TestPool(unittest.TestCase):
+ assert isinstance(p.get_exception(), pool.ThreadException)
+ assert len([q for q in queues if q.get_nowait.called]) == 1
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_get_response_returns_none_when_queue_is_empty(self):
+ """Ensure that None is returned when the response Queue is empty."""
+ queues = []
+@@ -187,6 +194,7 @@ class TestPool(unittest.TestCase):
+ assert p.get_response() is None
+ assert len([q for q in queues if q.get_nowait.called]) == 1
+
++ @pytest.mark.skipif(sys.hexversion < 0x3000000, reason="broken on python2")
+ def test_get_exception_returns_none_when_queue_is_empty(self):
+ """Ensure that None is returned when the exception Queue is empty."""
+ queues = []
diff --git a/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests.patch b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests.patch
new file mode 100644
index 000000000000..a2a8929b08d4
--- /dev/null
+++ b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-tests.patch
@@ -0,0 +1,128 @@
+From c4f918572751151eb3bfc7dfa94580b3e2867a9e Mon Sep 17 00:00:00 2001
+From: Jon Dufresne <jon.dufresne@gmail.com>
+Date: Sun, 3 Feb 2019 09:02:24 -0800
+Subject: [PATCH] Fix unhandled exceptions from threads during tests
+
+A queue.Queue() object was not always passed to SessionThread. In this
+case, SessionThread._make_request() would raise an exception trying to
+call methods on the expected object. Now, always pass a usable object to
+SessionThread.
+
+Previously appeared as:
+
+ Traceback (most recent call last):
+ File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
+ self.run()
+ File "/usr/lib64/python3.7/threading.py", line 865, in run
+ self._target(*self._args, **self._kwargs)
+ File "toolbelt/requests_toolbelt/threaded/thread.py", line 41, in _make_request
+ kwargs = self._jobs.get_nowait()
+ AttributeError: 'NoneType' object has no attribute 'get_nowait'
+
+ Exception in thread cd08fad6-d21d-41b0-921e-737a149b12be:
+ Traceback (most recent call last):
+ File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
+ self.run()
+ File "/usr/lib64/python3.7/threading.py", line 865, in run
+ self._target(*self._args, **self._kwargs)
+ File "toolbelt/requests_toolbelt/threaded/thread.py", line 41, in _make_request
+ kwargs = self._jobs.get_nowait()
+ AttributeError: 'NoneType' object has no attribute 'get_nowait'
+
+ Exception in thread 4fb72f0d-ba1c-4a78-97a2-4a7283ea01fe:
+ Traceback (most recent call last):
+ File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
+ self.run()
+ File "/usr/lib64/python3.7/threading.py", line 865, in run
+ self._target(*self._args, **self._kwargs)
+ File "toolbelt/requests_toolbelt/threaded/thread.py", line 41, in _make_request
+ kwargs = self._jobs.get_nowait()
+ AttributeError: 'NoneType' object has no attribute 'get_nowait'
+
+ Exception in thread 5f3711af-0c01-4821-9e25-8074bbbf769b:
+ Traceback (most recent call last):
+ File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
+ self.run()
+ File "/usr/lib64/python3.7/threading.py", line 865, in run
+ self._target(*self._args, **self._kwargs)
+ File "toolbelt/requests_toolbelt/threaded/thread.py", line 41, in _make_request
+ kwargs = self._jobs.get_nowait()
+ AttributeError: 'NoneType' object has no attribute 'get_nowait'
+---
+ tests/threaded/test_pool.py | 15 ++++++++++-----
+ tests/threaded/test_thread.py | 5 ++++-
+ 2 files changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/tests/threaded/test_pool.py b/tests/threaded/test_pool.py
+index b0653bb..b949dd8 100644
+--- a/tests/threaded/test_pool.py
++++ b/tests/threaded/test_pool.py
+@@ -26,32 +26,37 @@ def test_requires_positive_number_of_processes(self):
+
+ def test_number_of_processes_can_be_arbitrary(self):
+ """Show that the number of processes can be set."""
+- p = pool.Pool(None, num_processes=100)
++ job_queue = queue.Queue()
++ p = pool.Pool(job_queue, num_processes=100)
+ assert p._processes == 100
+ assert len(p._pool) == 100
+
+- p = pool.Pool(None, num_processes=1)
++ job_queue = queue.Queue()
++ p = pool.Pool(job_queue, num_processes=1)
+ assert p._processes == 1
+ assert len(p._pool) == 1
+
+ def test_initializer_is_called(self):
+ """Ensure that the initializer function is called."""
++ job_queue = queue.Queue()
+ initializer = mock.MagicMock()
+- pool.Pool(None, num_processes=1, initializer=initializer)
++ pool.Pool(job_queue, num_processes=1, initializer=initializer)
+ assert initializer.called is True
+ initializer.assert_called_once_with(mock.ANY)
+
+ def test_auth_generator_is_called(self):
+ """Ensure that the auth_generator function is called."""
++ job_queue = queue.Queue()
+ auth_generator = mock.MagicMock()
+- pool.Pool(None, num_processes=1, auth_generator=auth_generator)
++ pool.Pool(job_queue, num_processes=1, auth_generator=auth_generator)
+ assert auth_generator.called is True
+ auth_generator.assert_called_once_with(mock.ANY)
+
+ def test_session_is_called(self):
+ """Ensure that the session function is called."""
++ job_queue = queue.Queue()
+ session = mock.MagicMock()
+- pool.Pool(None, num_processes=1, session=session)
++ pool.Pool(job_queue, num_processes=1, session=session)
+ assert session.called is True
+ session.assert_called_once_with()
+
+diff --git a/tests/threaded/test_thread.py b/tests/threaded/test_thread.py
+index bb92f7f..fd7e96b 100644
+--- a/tests/threaded/test_thread.py
++++ b/tests/threaded/test_thread.py
+@@ -19,6 +19,8 @@ def _make_mocks():
+
+ def _initialize_a_session_thread(session=None, job_queue=None,
+ response_queue=None, exception_queue=None):
++ if job_queue is None:
++ job_queue = queue.Queue()
+ with mock.patch.object(threading, 'Thread') as Thread:
+ thread_instance = mock.MagicMock()
+ Thread.return_value = thread_instance
+@@ -52,10 +54,11 @@ def test_thread_initialization(self):
+
+ def test_is_alive_proxies_to_worker(self):
+ """Test that we proxy the is_alive method to the Thread."""
++ job_queue = queue.Queue()
+ with mock.patch.object(threading, 'Thread') as Thread:
+ thread_instance = mock.MagicMock()
+ Thread.return_value = thread_instance
+- st = thread.SessionThread(None, None, None, None)
++ st = thread.SessionThread(None, job_queue, None, None)
+
+ st.is_alive()
+ thread_instance.is_alive.assert_called_once_with()
diff --git a/dev-python/requests-toolbelt/requests-toolbelt-0.9.1.ebuild b/dev-python/requests-toolbelt/requests-toolbelt-0.9.1.ebuild
index ed22f1180b01..83387a6acd91 100644
--- a/dev-python/requests-toolbelt/requests-toolbelt-0.9.1.ebuild
+++ b/dev-python/requests-toolbelt/requests-toolbelt-0.9.1.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=7
-PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
+PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} )
inherit distutils-r1
@@ -12,7 +12,7 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
-KEYWORDS="amd64 ~arm ~arm64 ~ppc64 x86"
+KEYWORDS="amd64 ~arm ~arm64 ~hppa ~ppc64 ~sparc x86"
IUSE="test"
RDEPEND="<dev-python/requests-3.0.0[${PYTHON_USEDEP}]"
@@ -21,20 +21,21 @@ DEPEND="${RDEPEND}
test? (
dev-python/betamax[${PYTHON_USEDEP}]
dev-python/mock[${PYTHON_USEDEP}]
- dev-python/pytest[${PYTHON_USEDEP}]
)"
DOCS=( AUTHORS.rst HISTORY.rst README.rst )
+
PATCHES=(
"${FILESDIR}/requests-toolbelt-0.8.0-test-tracebacks.patch"
-)
+ "${FILESDIR}/requests-toolbelt-0.9.1-tests.patch"
-# Known python2.7 test failures do to upstream
-# not testing with newer requests versions
-# bug: https://bugs.gentoo.org/635824
-# https://github.com/requests/toolbelt/issues/213
-RESTRICT=test
+ # disable python2.7 test failures with newer requests versions
+ # bug: https://bugs.gentoo.org/635824
+ # https://github.com/requests/toolbelt/issues/213
+ "${FILESDIR}/requests-toolbelt-0.9.1-tests-py2.patch"
+
+ # disable tests that require internet access
+ "${FILESDIR}/requests-toolbelt-0.9.1-tests-internet.patch"
+)
-python_test() {
- py.test -v || die "Tests failed with ${EPYTHON}"
-}
+distutils_enable_tests pytest