Skip to content

Commit

Permalink
Fix urllib3 tests following the release of v2.0.0 (#2162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed May 14, 2023
1 parent 8763111 commit 554d93e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements_test_brain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ regex
types-python-dateutil
six
types-six
urllib3
urllib3>1,<2
typing_extensions>=4.4.0
7 changes: 4 additions & 3 deletions tests/test_modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"])


Expand Down

0 comments on commit 554d93e

Please sign in to comment.