From d0fb833426b84d47f72249914af2f9997bccb794 Mon Sep 17 00:00:00 2001 From: Maria Knorps Date: Wed, 3 Jan 2024 11:32:57 +0100 Subject: [PATCH] Add a test case for a path with disc name on Windows --- tests/test_types.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test_types.py b/tests/test_types.py index 3c7a79ca..74d322cf 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -4,6 +4,7 @@ import sys from dataclasses import FrozenInstanceError from pathlib import Path +import sys import pytest @@ -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