Skip to content

Commit

Permalink
Add a test case for a path with disc name on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mknorps committed Jan 3, 2024
1 parent e455333 commit dadf267
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from dataclasses import FrozenInstanceError
from pathlib import Path
import sys

import pytest

Expand Down Expand Up @@ -38,11 +39,23 @@
212,
),
"rel_path_line": ((Path("foo"), None, 4), "foo:4", 312),
"abs_path_drive_prefix": ((Path("C:/foo/bar"),), "C:\\foo\\bar", 222),
}


@pytest.mark.parametrize(
"args,string,_", [pytest.param(*data, id=key) for key, data in testdata.items()]
"args,string,_",
[
pytest.param(
*data,
id=key,
marks=pytest.mark.skipif(
key == "abs_path_drive_prefix" and not sys.platform.startswith("win"),
reason="Drive prefix is used in Windows systems only.",
),
)
for key, data in testdata.items()
],
)
def test_location__str(args, string, _):
assert str(Location(*args)) == string
Expand Down

0 comments on commit dadf267

Please sign in to comment.