Skip to content

Commit

Permalink
squash! Split up Windows tests relying on urlunparse behaviour
Browse files Browse the repository at this point in the history
Make behaviour check automatic to save on maintenance
  • Loading branch information
matthewhughes934 committed Jun 24, 2024
1 parent ebdd028 commit f9e5477
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Union,
cast,
)
from urllib.parse import urlparse, urlunparse
from zipfile import ZipFile

import pytest
Expand Down Expand Up @@ -1378,13 +1379,8 @@ def __call__(

# versions containing fix/backport from https://github.com/python/cpython/pull/113563
# which changed the behavior of `urllib.parse.urlun{parse,split}`
has_new_urlun_behavior = (
# https://github.com/python/cpython/commit/387ff96e95b9f8a8cc7e646523ba3175b1350669
(sys.version_info[:2] == (3, 12) and sys.version_info >= (3, 12, 4))
or
# https://github.com/python/cpython/commit/872000606271c52d989e53fe4cc9904343d81855
(sys.version_info[:2] == (3, 13) and sys.version_info >= (3, 13, 0, "beta", 2))
)
url = "////path/to/file"
has_new_urlun_behavior = url == urlunparse(urlparse(url))

# the above change seems to only impact tests on Windows, so just add skips for that
skip_needs_new_urlun_behavior_win = pytest.mark.skipif(
Expand Down

0 comments on commit f9e5477

Please sign in to comment.