Skip to content

Commit 1256e42

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 025ab7d commit 1256e42

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
@@ -30,6 +30,7 @@
3030
from _pytest.outcomes import fail
3131
from _pytest.outcomes import Failed
3232
from _pytest.store import Store
33+
from _pytest.pathlib import Path
3334

3435
if TYPE_CHECKING:
3536
# Imported here due to circular import.
@@ -360,7 +361,7 @@ def _repr_failure_py(
360361
truncate_locals = True
361362

362363
try:
363-
abspath = os.getcwd() != str(self.config.invocation_dir)
364+
abspath = Path(os.getcwd()) != Path(self.config.invocation_dir)
364365
except OSError:
365366
abspath = True
366367

0 commit comments

Comments
 (0)