Skip to content

Commit c849bf4

Browse files
committed
Use Path() instead of str for path comparison
On Windows specifically is common to have drives diverging just by casing ("C:" vs "c:"), depending on the cwd provided by the user.
1 parent 1bad70f commit c849bf4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_pytest/nodes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from _pytest.mark.structures import MarkDecorator
2727
from _pytest.mark.structures import NodeKeywords
2828
from _pytest.outcomes import Failed
29+
from _pytest.pathlib import Path
2930

3031
if False: # TYPE_CHECKING
3132
# Imported here due to circular import.
@@ -325,7 +326,7 @@ def _repr_failure_py(
325326
truncate_locals = True
326327

327328
try:
328-
abspath = os.getcwd() != str(self.config.invocation_dir)
329+
abspath = Path(os.getcwd()) != Path(self.config.invocation_dir)
329330
except OSError:
330331
abspath = True
331332

0 commit comments

Comments
 (0)