diff --git a/.python-requests-toolbelt.metadata b/.python-requests-toolbelt.metadata new file mode 100644 index 0000000..0fddb35 --- /dev/null +++ b/.python-requests-toolbelt.metadata @@ -0,0 +1 @@ +f00209ed292de4127cf21160e48ab2acc76573d0 SOURCES/requests-toolbelt-0.9.1.tar.gz diff --git a/SOURCES/python-requests-toolbelt-fix-unhandled-exception-from-tests.patch b/SOURCES/python-requests-toolbelt-fix-unhandled-exception-from-tests.patch new file mode 100644 index 0000000..832e0e2 --- /dev/null +++ b/SOURCES/python-requests-toolbelt-fix-unhandled-exception-from-tests.patch @@ -0,0 +1,130 @@ +From c4f918572751151eb3bfc7dfa94580b3e2867a9e Mon Sep 17 00:00:00 2001 +From: Jon Dufresne +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' + +https://github.com/requests/toolbelt/commit/c4f918572751151eb3bfc7dfa94580b3e2867a9e +--- + 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/SOURCES/python-requests-toolbelt-pass-session-into-tests.patch b/SOURCES/python-requests-toolbelt-pass-session-into-tests.patch new file mode 100644 index 0000000..57927a6 --- /dev/null +++ b/SOURCES/python-requests-toolbelt-pass-session-into-tests.patch @@ -0,0 +1,61 @@ +From 1314a8ea82f4dcfb23e670f17d1b40c23ba230c4 Mon Sep 17 00:00:00 2001 +From: Alexander Mangin +Date: Wed, 3 Apr 2019 12:57:40 +0500 +Subject: [PATCH] Pass session into some tests + +--- + ...ream_response_without_content_length_to_file.json | 1 + + tests/test_multipart_encoder.py | 12 ++++++------ + 2 files changed, 7 insertions(+), 6 deletions(-) + create mode 100644 tests/cassettes/stream_response_without_content_length_to_file.json + +diff --git a/tests/cassettes/stream_response_without_content_length_to_file.json b/tests/cassettes/stream_response_without_content_length_to_file.json +new file mode 100644 +index 0000000..f2bf898 +--- /dev/null ++++ b/tests/cassettes/stream_response_without_content_length_to_file.json +@@ -0,0 +1 @@ ++{"recorded_with": "betamax/0.4.1", "http_interactions": [{"request": {"uri": "https://api.github.com/repos/sigmavirus24/github3.py/releases/assets/37944", "method": "GET", "headers": {"Accept": ["application/octet-stream"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "User-Agent": ["python-requests/2.5.3 CPython/2.7.9 Darwin/14.1.0"]}, "body": {"base64_string": "", "encoding": "utf-8"}}, "response": {"status": {"code": 302, "message": "Found"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/releases/assets/37944", "headers": {"access-control-allow-credentials": ["true"], "x-xss-protection": ["1; mode=block"], "vary": ["Accept-Encoding"], "location": ["https://s3.amazonaws.com/github-cloud/releases/3710711/365425c2-4e46-11e3-86fb-bb0d50a886e7.whl?response-content-disposition=attachment%3B%20filename%3Dgithub3.py-0.7.1-py2.py3-none-any.whl&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1426166613&Signature=78anFgNgXLm3TIbo%2FbTEEk7m%2F34%3D"], "x-content-type-options": ["nosniff"], "content-security-policy": ["default-src 'none'"], "x-ratelimit-limit": ["60"], "status": ["302 Found"], "x-frame-options": ["deny"], "x-served-by": ["8dd185e423974a7e13abbbe6e060031e"], "server": ["GitHub.com"], "access-control-allow-origin": ["*"], "strict-transport-security": ["max-age=31536000; includeSubdomains; preload"], "x-github-request-id": ["48A0C951:54E7:48B5311:55019319"], "date": ["Thu, 12 Mar 2015 13:22:33 GMT"], "access-control-expose-headers": ["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"], "x-ratelimit-remaining": ["58"], "content-type": ["text/html;charset=utf-8"], "x-ratelimit-reset": ["1426170017"]}, "body": {"base64_string": "", "encoding": "utf-8"}}, "recorded_at": "2015-03-12T13:22:33"}, {"request": {"uri": "https://s3.amazonaws.com/github-cloud/releases/3710711/365425c2-4e46-11e3-86fb-bb0d50a886e7.whl?response-content-disposition=attachment%3B%20filename%3Dgithub3.py-0.7.1-py2.py3-none-any.whl&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1426166613&Signature=78anFgNgXLm3TIbo%2FbTEEk7m%2F34%3D", "method": "GET", "headers": {"Accept": ["application/octet-stream"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "User-Agent": ["python-requests/2.5.3 CPython/2.7.9 Darwin/14.1.0"]}, "body": {"base64_string": "", "encoding": "utf-8"}}, "response": {"status": {"code": 200, "message": "OK"}, "url": "https://s3.amazonaws.com/github-cloud/releases/3710711/365425c2-4e46-11e3-86fb-bb0d50a886e7.whl?response-content-disposition=attachment%3B%20filename%3Dgithub3.py-0.7.1-py2.py3-none-any.whl&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1426166613&Signature=78anFgNgXLm3TIbo%2FbTEEk7m%2F34%3D", "headers": {"accept-ranges": ["bytes"], "content-disposition": ["attachment; filename=github3.py-0.7.1-py2.py3-none-any.whl"], "x-amz-id-2": ["9+TuHhbd7y2BUJaEV+mFpaDgjl1g9uSAPiZxwc6b2cYydhlhZSyKSuB7PQyiPBPD"], "x-amz-meta-surrogate-key": ["repository-3710711 user-240830"], "x-amz-request-id": ["4B4BFE6BF5135B8D"], "last-modified": ["Fri, 15 Nov 2013 22:35:23 GMT"], "x-amz-meta-surrogate-control": ["max-age=31557600"], "etag": ["\"6550854f02f7bf10b944070b84f38313\""], "date": ["Thu, 12 Mar 2015 13:22:35 GMT"], "cache-control": ["max-age=31557600"], "content-type": ["application/octet-stream"], "server": ["AmazonS3"]}, "body": {"base64_string": "", "encoding": null}}, "recorded_at": "2015-03-12T13:22:34"}]} +diff --git a/tests/test_multipart_encoder.py b/tests/test_multipart_encoder.py +index 575f54c..2d143ae 100644 +--- a/tests/test_multipart_encoder.py ++++ b/tests/test_multipart_encoder.py +@@ -91,14 +91,14 @@ def test_accepts_encoded_strings_with_unicode(self): + + class TestFileFromURLWrapper(unittest.TestCase): + def setUp(self): +- s = requests.Session() +- self.recorder = get_betamax(s) ++ self.session = requests.Session() ++ self.recorder = get_betamax(self.session) + + def test_read_file(self): + url = ('https://stxnext.com/static/img/logo.830ebe551641.svg') + with self.recorder.use_cassette( + 'file_for_download', **preserve_bytes): +- self.instance = FileFromURLWrapper(url) ++ self.instance = FileFromURLWrapper(url, session=self.session) + assert self.instance.len == 5177 + chunk = self.instance.read(20) + assert chunk == b' - 0.9.1-16 +- Rebuild from lookaside + +* Fri Jul 23 2021 Fedora Release Engineering - 0.9.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 0.9.1-14 +- Rebuilt for Python 3.10 + +* Sat May 15 2021 Parag Nemade - 0.9.1-13 +- Disable some tests for Python 3.10 bootstrap process + +* Wed Jan 27 2021 Fedora Release Engineering - 0.9.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sun Oct 18 2020 Parag Nemade - 0.9.1-11 +- Ignore failing tests (rh#1863713) + +* Sat Aug 01 2020 Fedora Release Engineering - 0.9.1-10 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 0.9.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon May 25 2020 Miro Hrončok - 0.9.1-8 +- Rebuilt for Python 3.9 + +* Sat Apr 11 2020 Felix Schwarz - 0.9.1-7 +- run test suite in %%check + +* Thu Jan 30 2020 Fedora Release Engineering - 0.9.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 0.9.1-5 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 0.9.1-4 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.9.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Apr 04 2019 Parag Nemade - 0.9.1-2 +- Remove python2 subpackage (#1696338) + +* Thu Jan 31 2019 Parag Nemade - 0.9.1-1 +- Update to 0.9.1 version (#1670521) + +* Sat Jul 14 2018 Fedora Release Engineering - 0.8.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 0.8.0-4 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.8.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.8.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sun May 21 2017 Parag Nemade - 0.8.0-1 +- Update to 0.8.0 version + +* Mon Mar 20 2017 Parag Nemade - 0.7.1-1 +- Update to 0.7.1 version + +* Sat Feb 11 2017 Fedora Release Engineering - 0.7.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 0.7.0-2 +- Rebuild for Python 3.6 + +* Sun Jul 24 2016 Igor Gnatenko - 0.7.0-1 +- Update to 0.7.0 (RHBZ #1359456) + +* Tue Jul 19 2016 Fedora Release Engineering - 0.6.2-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed Jun 29 2016 Igor Gnatenko - 0.6.2-1 +- Update to 0.6.2 +- Add proper python2 subpackage +- Run tests properly +- Other fixes + +* Mon May 09 2016 Parag Nemade - 0.6.1-1 +- update to 0.6.1 release + +* Thu Feb 04 2016 Fedora Release Engineering - 0.6.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jan 28 2016 Parag Nemade - 0.6.0-1 +- update to 0.6.0 release + +* Mon Dec 21 2015 Parag Nemade - 0.5.1-1 +- update to 0.5.1 release + +* Thu Nov 26 2015 Parag Nemade - 0.5.0-1 +- update to 0.5.0 release + +* Tue Nov 10 2015 Fedora Release Engineering - 0.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.4.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Apr 06 2015 Parag Nemade - 0.4.0-1 +- update to 0.4.0 release + +* Fri Feb 13 2015 Parag Nemade - 0.3.1-2 +- Add missing LICENSE file + +* Mon Feb 02 2015 Parag Nemade - 0.3.1-1 +- Initial packaging +