-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFE: please provide support for latest urllib3
#6278
Comments
Just tested build with below patch: --- a/setup.py
+++ b/setup.py
@@ -59,9 +59,9 @@
sys.exit()
requires = [
- "charset_normalizer>=2,<3",
- "idna>=2.5,<4",
- "urllib3>=1.21.1,<1.27",
+ "charset_normalizer>=2",
+ "idna>=2.5",
+ "urllib3>=1.21.1",
]
test_requirements = [
"pytest-httpbin==0.0.7",
--- a/requests/__init__.py
+++ b/requests/__init__.py
@@ -54,66 +54,6 @@
except ImportError:
chardet_version = None
-
-def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version):
- urllib3_version = urllib3_version.split(".")
- assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git.
-
- # Sometimes, urllib3 only reports its version as 16.1.
- if len(urllib3_version) == 2:
- urllib3_version.append("0")
-
- # Check urllib3 for compatibility.
- major, minor, patch = urllib3_version # noqa: F811
- major, minor, patch = int(major), int(minor), int(patch)
- # urllib3 >= 1.21.1, <= 1.26
- assert major == 1
- assert minor >= 21
- assert minor <= 26
-
- # Check charset_normalizer for compatibility.
- if chardet_version:
- major, minor, patch = chardet_version.split(".")[:3]
- major, minor, patch = int(major), int(minor), int(patch)
- # chardet_version >= 3.0.2, < 6.0.0
- assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0)
- elif charset_normalizer_version:
- major, minor, patch = charset_normalizer_version.split(".")[:3]
- major, minor, patch = int(major), int(minor), int(patch)
- # charset_normalizer >= 2.0.0 < 3.0.0
- assert (2, 0, 0) <= (major, minor, patch) < (3, 0, 0)
- else:
- raise Exception("You need either charset_normalizer or chardet installed")
-
-
-def _check_cryptography(cryptography_version):
- # cryptography < 1.3.4
- try:
- cryptography_version = list(map(int, cryptography_version.split(".")))
- except ValueError:
- return
-
- if cryptography_version < [1, 3, 4]:
- warning = "Old version of cryptography ({}) may cause slowdown.".format(
- cryptography_version
- )
- warnings.warn(warning, RequestsDependencyWarning)
-
-
-# Check imported dependencies for compatibility.
-try:
- check_compatibility(
- urllib3.__version__, chardet_version, charset_normalizer_version
- )
-except (AssertionError, ValueError):
- warnings.warn(
- "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
- "version!".format(
- urllib3.__version__, chardet_version, charset_normalizer_version
- ),
- RequestsDependencyWarning,
- )
-
# Attempt to enable urllib3's fallback for SNI support
# if the standard library doesn't support SNI or the
# 'ssl' library isn't available.
@@ -128,10 +68,6 @@
pyopenssl.inject_into_urllib3()
- # Check cryptography version
- from cryptography import __version__ as cryptography_version
-
- _check_cryptography(cryptography_version)
except ImportError:
pass
and looks like pytest is passing without aany problems + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.28.1-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.28.1-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra tests
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/requests-2.28.1, configfile: pyproject.toml
plugins: mock-3.10.0, httpbin-1.0.2
collected 593 items
tests/test_help.py ... [ 0%]
tests/test_hooks.py ... [ 1%]
tests/test_lowlevel.py .................... [ 4%]
tests/test_packages.py ... [ 4%]
tests/test_requests.py ...................................127.0.0.1 - - [07/Nov/2022 16:15:04] "GET /relative-redirect/20 HTTP/1.1" 302 0
.............................................................127.0.0.1 - - [07/Nov/2022 16:15:10] "GET /status/404 HTTP/1.1" 404 0
.......................pytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)
attempting to ignore so the rest of the tests can run
...................... [ 28%]
......................................................................127.0.0.1 - - [07/Nov/2022 16:15:11] "GET /get HTTP/1.1" 200 222
................x............................................................................. [ 56%]
............. [ 58%]
tests/test_structures.py .................... [ 61%]
tests/test_testserver.py ......s.... [ 63%]
tests/test_utils.py ..s............................................................................................................................................. [ 88%]
.......................................................sssssssssss..... [100%]
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_testserver.py:94: this fails non-deterministically under pytest-xdist
SKIPPED [1] tests/test_utils.py:49: condition: cStringIO is None
SKIPPED [10] tests/test_utils.py:814: Test only on Windows
SKIPPED [1] tests/test_utils.py:867: Test only on Windows
XFAIL tests/test_requests.py::TestRequests::test_response_iter_lines_reentrant
========================================================== 579 passed, 13 skipped, 1 xfailed in 76.39s (0:01:16) =========================================================== |
This is unrelated to urllib3. Resolving as duplicate of your other ticket: #6272. |
Issue is as well that module initialisation should not contain such checks. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
requests/setup.cfg
Lines 6 to 10 in 1e62a3e
The text was updated successfully, but these errors were encountered: