* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-toolbelt/files/, dev-python/requests-toolbelt/
@ 2019-11-22 19:41 Patrick McLean
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McLean @ 2019-11-22 19:41 UTC (permalink / raw
To: gentoo-commits
commit: 77ee7c8679e74c284e6fa2d444c8d179401bbe4b
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Fri Nov 22 19:40:16 2019 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Nov 22 19:41:05 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77ee7c86
dev-python/requests-toolbelt: Version bump to 0.9.1
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
.../requests-toolbelt-0.9.1-tests-internet.patch | 28 +++++
.../files/requests-toolbelt-0.9.1-tests-py2.patch | 68 +++++++++++
.../files/requests-toolbelt-0.9.1-tests.patch | 128 +++++++++++++++++++++
.../requests-toolbelt-0.9.1.ebuild | 23 ++--
4 files changed, 236 insertions(+), 11 deletions(-)
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 00000000000..b3dc2603c11
--- /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 00000000000..6825c5f4ed4
--- /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 00000000000..a2a8929b08d
--- /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 ed22f1180b0..d2eb47414a4 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}} pypy{,3} )
inherit distutils-r1
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-toolbelt/files/, dev-python/requests-toolbelt/
@ 2021-06-02 16:26 Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2021-06-02 16:26 UTC (permalink / raw
To: gentoo-commits
commit: 7636ae1dea275d4302aafea4c7016917543264b8
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 2 16:25:52 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 2 16:26:33 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7636ae1d
dev-python/requests-toolbelt: Enable py3.10
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
.../files/requests-toolbelt-0.9.1-py310.patch | 37 ++++++++++++++++++++++
.../requests-toolbelt-0.9.1.ebuild | 4 ++-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-py310.patch b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-py310.patch
new file mode 100644
index 00000000000..182e413158c
--- /dev/null
+++ b/dev-python/requests-toolbelt/files/requests-toolbelt-0.9.1-py310.patch
@@ -0,0 +1,37 @@
+From 7188b06330e5260be20bce8cbcf0d5ae44e34eaf Mon Sep 17 00:00:00 2001
+From: Jon Dufresne <jon.dufresne@gmail.com>
+Date: Fri, 1 Feb 2019 16:30:01 -0800
+Subject: [PATCH] Fix collections.abc deprecation warning in downloadutils
+
+Warning appears as:
+
+tests/test_downloadutils.py::test_stream_response_to_specific_filename
+ requests_toolbelt/downloadutils/stream.py:161: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
+ if path and isinstance(getattr(path, 'write', None), collections.Callable):
+---
+ requests_toolbelt/downloadutils/stream.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/requests_toolbelt/downloadutils/stream.py b/requests_toolbelt/downloadutils/stream.py
+index eed60a7..1d1c31b 100644
+--- a/requests_toolbelt/downloadutils/stream.py
++++ b/requests_toolbelt/downloadutils/stream.py
+@@ -1,6 +1,5 @@
+ # -*- coding: utf-8 -*-
+ """Utilities for dealing with streamed requests."""
+-import collections
+ import os.path
+ import re
+
+@@ -158,7 +157,7 @@ def stream_response_to_file(response, path=None, chunksize=_DEFAULT_CHUNKSIZE):
+ pre_opened = False
+ fd = None
+ filename = None
+- if path and isinstance(getattr(path, 'write', None), collections.Callable):
++ if path and callable(getattr(path, 'write', None)):
+ pre_opened = True
+ fd = path
+ filename = getattr(fd, 'name', None)
+--
+2.31.1
+
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 dd4056a4fc3..afbd3421e3a 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=( python3_{7..9} pypy3 )
+PYTHON_COMPAT=( python3_{7..10} pypy3 )
inherit distutils-r1
@@ -36,6 +36,8 @@ PATCHES=(
# disable tests that require internet access
"${FILESDIR}/requests-toolbelt-0.9.1-tests-internet.patch"
+
+ "${FILESDIR}/requests-toolbelt-0.9.1-py310.patch"
)
distutils_enable_tests pytest
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-02 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-22 19:41 [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-toolbelt/files/, dev-python/requests-toolbelt/ Patrick McLean
-- strict thread matches above, loose matches on Subject: below --
2021-06-02 16:26 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox