Skip to content

Commit

Permalink
Merge pull request #12774 from uranusjr/disable-313-uri-test
Browse files Browse the repository at this point in the history
Mark failing tests on Windows + Py3.13 as xfail
  • Loading branch information
pradyunsg authored Jun 20, 2024
2 parents 205af8e + 87f874f commit 075a3dd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
10 changes: 8 additions & 2 deletions tests/unit/test_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ def test_clean_url_path_with_local_path(path: str, expected: str) -> None:
pytest.param(
"file:///T:/path/with spaces/",
"file:///T:/path/with%20spaces",
marks=pytest.mark.skipif("sys.platform != 'win32'"),
marks=pytest.mark.skipif(
"sys.platform != 'win32' or "
"sys.version_info == (3, 13, 0, 'beta', 2)"
),
),
# URL with Windows drive letter, running on non-windows
# platform. The `:` after the drive should be quoted.
Expand All @@ -396,7 +399,10 @@ def test_clean_url_path_with_local_path(path: str, expected: str) -> None:
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'"),
marks=pytest.mark.skipif(
"sys.platform != 'win32' or "
"sys.version_info == (3, 13, 0, 'beta', 2)"
),
),
# Test a VCS URL with a Windows drive letter and revision,
# running on non-windows platform.
Expand Down
30 changes: 24 additions & 6 deletions tests/unit/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,30 @@ def test_path_to_url_unix() -> None:


@pytest.mark.skipif("sys.platform != 'win32'")
def test_path_to_url_win() -> None:
assert path_to_url("c:/tmp/file") == "file:///C:/tmp/file"
assert path_to_url("c:\\tmp\\file") == "file:///C:/tmp/file"
assert path_to_url(r"\\unc\as\path") == "file://unc/as/path"
path = os.path.join(os.getcwd(), "file")
assert path_to_url("file") == "file:" + urllib.request.pathname2url(path)
@pytest.mark.parametrize(
"path, url",
[
pytest.param("c:/tmp/file", "file:///C:/tmp/file", id="posix-path"),
pytest.param("c:\\tmp\\file", "file:///C:/tmp/file", id="nt-path"),
pytest.param(
r"\\unc\as\path",
"file://unc/as/path",
marks=pytest.mark.skipif(
"sys.platform != 'win32' or "
"sys.version_info == (3, 13, 0, 'beta', 2)"
),
id="unc-path",
),
],
)
def test_path_to_url_win(path: str, url: str) -> None:
assert path_to_url(path) == url


@pytest.mark.skipif("sys.platform != 'win32'")
def test_relative_path_to_url_win() -> None:
resolved_path = os.path.join(os.getcwd(), "file")
assert path_to_url("file") == "file:" + urllib.request.pathname2url(resolved_path)


@pytest.mark.parametrize(
Expand Down

0 comments on commit 075a3dd

Please sign in to comment.