From 554d93ee2718fb4131ee2b9733253cd4f1fc6619 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 1 May 2023 21:48:06 +0200 Subject: [PATCH] Fix urllib3 tests following the release of v2.0.0 (#2162) --- requirements_test_brain.txt | 2 +- tests/test_modutils.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/requirements_test_brain.txt b/requirements_test_brain.txt index b4778baea..2014e07ae 100644 --- a/requirements_test_brain.txt +++ b/requirements_test_brain.txt @@ -8,5 +8,5 @@ regex types-python-dateutil six types-six -urllib3 +urllib3>1,<2 typing_extensions>=4.4.0 diff --git a/tests/test_modutils.py b/tests/test_modutils.py index 0c8bee888..04f5eeed6 100644 --- a/tests/test_modutils.py +++ b/tests/test_modutils.py @@ -28,9 +28,9 @@ try: import urllib3 # pylint: disable=unused-import - HAS_URLLIB3 = True + HAS_URLLIB3_V1 = urllib3.__version__.startswith("1") except ImportError: - HAS_URLLIB3 = False + HAS_URLLIB3_V1 = False def _get_file_from_object(obj) -> str: @@ -547,8 +547,9 @@ def test_is_module_name_part_of_extension_package_whitelist_success(self) -> Non ) -@pytest.mark.skipif(not HAS_URLLIB3, reason="This test requires urllib3.") +@pytest.mark.skipif(not HAS_URLLIB3_V1, reason="This test requires urllib3 < 2.") def test_file_info_from_modpath__SixMetaPathImporter() -> None: + """Six is not backported anymore in urllib3 v2.0.0+""" assert modutils.file_info_from_modpath(["urllib3.packages.six.moves.http_client"])