-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Mark failing tests on Windows + Py3.13 as xfail #12774
Conversation
710ede5
to
872523d
Compare
This test should start passing when 3.13.0a2 is released, so the xfail set to strict=True will start causing the CI to error at the time. We'll remove the marker.
872523d
to
596be04
Compare
I think some more action will be needed in the future as these tests are failing for me on Windows on Python 3.12.4 (I see in CI the version used:
Test output$ nox -s test-3.12 -- -k test_ensure_quoted_url tests/unit/test_collector.py
nox > Running session test-3.12
nox > Re-using existing virtual environment at .nox\test-3-12.
nox > Re-using existing common-wheels at tests/data/common_wheels.
nox > python -m pip install build
nox > python -I -m build --sdist --outdir 'C:\Users\land_\src\pip\.nox\test-3-12\sdist'
nox > python tools/protected_pip.py install 'C:\Users\land_\src\pip\.nox\test-3-12\sdist\pip-24.1.dev2.tar.gz'
nox > python tools/protected_pip.py install -r tests/requirements.txt
nox > pytest -k test_ensure_quoted_url tests/unit/test_collector.py
============================= test session starts =============================
platform win32 -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0
rootdir: C:\Users\land_\src\pip
configfile: pyproject.toml
plugins: cov-5.0.0, rerunfailures-14.0, xdist-3.6.1
collected 113 items / 98 deselected / 15 selected
tests\unit\test_collector.py ...........FsFs [100%]
================================== FAILURES ===================================
_ test_ensure_quoted_url[file:///T:/path/with spaces/-file:///T:/path/with%20spaces] _
url = 'file:///T:/path/with spaces/'
clean_url = 'file:///T:/path/with%20spaces'
@pytest.mark.parametrize(
("url", "clean_url"),
[
# URL with hostname and port. Port separator should not be quoted.
(
"https://localhost.localdomain:8181/path/with space/",
"https://localhost.localdomain:8181/path/with%20space/",
),
# URL that is already properly quoted. The quoting `%`
# characters should not be quoted again.
(
"https://localhost.localdomain:8181/path/with%20quoted%20space/",
"https://localhost.localdomain:8181/path/with%20quoted%20space/",
),
# URL with IPv4 address and port.
(
"https://127.0.0.1:8181/path/with space/",
"https://127.0.0.1:8181/path/with%20space/",
),
# URL with IPv6 address and port. The `[]` brackets around the
# IPv6 address should not be quoted.
(
"https://[fd00:0:0:236::100]:8181/path/with space/",
"https://[fd00:0:0:236::100]:8181/path/with%20space/",
),
# URL with query. The leading `?` should not be quoted.
(
"https://localhost.localdomain:8181/path/with/query?request=test",
"https://localhost.localdomain:8181/path/with/query?request=test",
),
# URL with colon in the path portion.
(
"https://localhost.localdomain:8181/path:/with:/colon",
"https://localhost.localdomain:8181/path%3A/with%3A/colon",
),
# URL with something that looks like a drive letter, but is
# not. The `:` should be quoted.
(
"https://localhost.localdomain/T:/path/",
"https://localhost.localdomain/T%3A/path/",
),
# URL with a quoted "/" in the path portion.
(
"https://example.com/access%2Ftoken/path/",
"https://example.com/access%2Ftoken/path/",
),
# VCS URL containing revision string.
(
"git+ssh://example.com/path to/repo.git@1.0#egg=my-package-1.0",
"git+ssh://example.com/path%20to/repo.git@1.0#egg=my-package-1.0",
),
# VCS URL with a quoted "#" in the revision string.
(
"git+https://example.com/repo.git@hash%23symbol#egg=my-package-1.0",
"git+https://example.com/repo.git@hash%23symbol#egg=my-package-1.0",
),
# VCS URL with a quoted "@" in the revision string.
(
"git+https://example.com/repo.git@at%40 space#egg=my-package-1.0",
"git+https://example.com/repo.git@at%40%20space#egg=my-package-1.0",
),
# URL with Windows drive letter. The `:` after the drive
# letter should not be quoted. The trailing `/` should be
# removed.
pytest.param(
"file:///T:/path/with spaces/",
"file:///T:/path/with%20spaces",
marks=[
pytest.mark.skipif("sys.platform != 'win32'"),
pytest.mark.xfail(
reason="Failing in Python 3.13.0a1, fixed in python/cpython#113563",
condition="sys.version_info >= (3, 13)",
strict=True,
),
],
),
# URL with Windows drive letter, running on non-windows
# platform. The `:` after the drive should be quoted.
pytest.param(
"file:///T:/path/with spaces/",
"file:///T%3A/path/with%20spaces/",
marks=pytest.mark.skipif("sys.platform == 'win32'"),
),
# Test a VCS URL with a Windows drive letter and revision.
pytest.param(
"git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0",
"git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0",
marks=[
pytest.mark.skipif("sys.platform != 'win32'"),
pytest.mark.xfail(
reason="Failing in Python 3.13.0a1, fixed in python/cpython#113563",
condition="sys.version_info >= (3, 13)",
strict=True,
),
],
),
# Test a VCS URL with a Windows drive letter and revision,
# running on non-windows platform.
pytest.param(
"git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0",
"git+file:/T%3A/with%20space/repo.git@1.0#egg=my-package-1.0",
marks=pytest.mark.skipif("sys.platform == 'win32'"),
),
],
)
def test_ensure_quoted_url(url: str, clean_url: str) -> None:
> assert _ensure_quoted_url(url) == clean_url
E AssertionError: assert 'file://///T:...with%20spaces' == 'file:///T:/p...with%20spaces'
E
E - file:///T:/path/with%20spaces
E + file://///T:/path/with%20spaces
E ? ++
tests\unit\test_collector.py:425: AssertionError
_ test_ensure_quoted_url[git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0-git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0] _
url = 'git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0'
clean_url = 'git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0'
@pytest.mark.parametrize(
("url", "clean_url"),
[
# URL with hostname and port. Port separator should not be quoted.
(
"https://localhost.localdomain:8181/path/with space/",
"https://localhost.localdomain:8181/path/with%20space/",
),
# URL that is already properly quoted. The quoting `%`
# characters should not be quoted again.
(
"https://localhost.localdomain:8181/path/with%20quoted%20space/",
"https://localhost.localdomain:8181/path/with%20quoted%20space/",
),
# URL with IPv4 address and port.
(
"https://127.0.0.1:8181/path/with space/",
"https://127.0.0.1:8181/path/with%20space/",
),
# URL with IPv6 address and port. The `[]` brackets around the
# IPv6 address should not be quoted.
(
"https://[fd00:0:0:236::100]:8181/path/with space/",
"https://[fd00:0:0:236::100]:8181/path/with%20space/",
),
# URL with query. The leading `?` should not be quoted.
(
"https://localhost.localdomain:8181/path/with/query?request=test",
"https://localhost.localdomain:8181/path/with/query?request=test",
),
# URL with colon in the path portion.
(
"https://localhost.localdomain:8181/path:/with:/colon",
"https://localhost.localdomain:8181/path%3A/with%3A/colon",
),
# URL with something that looks like a drive letter, but is
# not. The `:` should be quoted.
(
"https://localhost.localdomain/T:/path/",
"https://localhost.localdomain/T%3A/path/",
),
# URL with a quoted "/" in the path portion.
(
"https://example.com/access%2Ftoken/path/",
"https://example.com/access%2Ftoken/path/",
),
# VCS URL containing revision string.
(
"git+ssh://example.com/path to/repo.git@1.0#egg=my-package-1.0",
"git+ssh://example.com/path%20to/repo.git@1.0#egg=my-package-1.0",
),
# VCS URL with a quoted "#" in the revision string.
(
"git+https://example.com/repo.git@hash%23symbol#egg=my-package-1.0",
"git+https://example.com/repo.git@hash%23symbol#egg=my-package-1.0",
),
# VCS URL with a quoted "@" in the revision string.
(
"git+https://example.com/repo.git@at%40 space#egg=my-package-1.0",
"git+https://example.com/repo.git@at%40%20space#egg=my-package-1.0",
),
# URL with Windows drive letter. The `:` after the drive
# letter should not be quoted. The trailing `/` should be
# removed.
pytest.param(
"file:///T:/path/with spaces/",
"file:///T:/path/with%20spaces",
marks=[
pytest.mark.skipif("sys.platform != 'win32'"),
pytest.mark.xfail(
reason="Failing in Python 3.13.0a1, fixed in python/cpython#113563",
condition="sys.version_info >= (3, 13)",
strict=True,
),
],
),
# URL with Windows drive letter, running on non-windows
# platform. The `:` after the drive should be quoted.
pytest.param(
"file:///T:/path/with spaces/",
"file:///T%3A/path/with%20spaces/",
marks=pytest.mark.skipif("sys.platform == 'win32'"),
),
# Test a VCS URL with a Windows drive letter and revision.
pytest.param(
"git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0",
"git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0",
marks=[
pytest.mark.skipif("sys.platform != 'win32'"),
pytest.mark.xfail(
reason="Failing in Python 3.13.0a1, fixed in python/cpython#113563",
condition="sys.version_info >= (3, 13)",
strict=True,
),
],
),
# Test a VCS URL with a Windows drive letter and revision,
# running on non-windows platform.
pytest.param(
"git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0",
"git+file:/T%3A/with%20space/repo.git@1.0#egg=my-package-1.0",
marks=pytest.mark.skipif("sys.platform == 'win32'"),
),
],
)
def test_ensure_quoted_url(url: str, clean_url: str) -> None:
> assert _ensure_quoted_url(url) == clean_url
E AssertionError: assert 'git+file:///...y-package-1.0' == 'git+file:///...y-package-1.0'
E
E - git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0
E + git+file://///T:/with%20space/repo.git@1.0#egg=my-package-1.0
E ? ++
tests\unit\test_collector.py:425: AssertionError
=========================== short test summary info ===========================
SKIPPED [2] tests\unit\test_collector.py:319: condition: sys.platform == 'win32'
FAILED tests/unit/test_collector.py::test_ensure_quoted_url[file:///T:/path/with spaces/-file:///T:/path/with%20spaces] - AssertionError: assert 'file://///T:...with%20spaces' == 'file:///T:/p...wi...
FAILED tests/unit/test_collector.py::test_ensure_quoted_url[git+file:///T:/with space/repo.git@1.0#egg=my-package-1.0-git+file:///T:/with%20space/repo.git@1.0#egg=my-package-1.0] - AssertionError: assert 'git+file:///...y-package-1.0' == 'git+file:///...y-... |
Yeah, I'm a bit confused by this approach (to mark xfail), as I read the change it is both intentional and being backported to all supported versions of CPython (bugfix and security!). And that both forms of the UNC path are valid and the new one is roundtripable. |
Some more context I found: The CPython change might actually addresses an old pip issue: #3783 the upstream issue for that issue python/cpython#78457 looks to be closed with changed linked above. Should |
Hmm yeah that sounds like a good idea to me. Let me play around. |
The awkward thing here is we can’t test against the urlunsplit fix because it’s not available in GHA until 3.13.0b3. I think I’m going to change the marker to skip the test until b3 to make the CI green for now, and address this when GHA upgrades. |
This test should start passing when 3.13.0a2 is released. Since the xfail marker is set to
strict=True
, it will start causing the CI to error to prompt us to revert this.See discussion in python/cpython#102511 for cause analysis and reference to fix.