Skip to content

Commit

Permalink
Use Path() instead of str for path comparison
Browse files Browse the repository at this point in the history
On Windows specifically is common to have drives diverging just by
casing ("C:" vs "c:"), depending on the cwd provided by the user.
  • Loading branch information
nicoddemus committed May 16, 2020
1 parent 025ab7d commit 1256e42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/_pytest/nodes.py
Expand Up @@ -30,6 +30,7 @@
from _pytest.outcomes import fail
from _pytest.outcomes import Failed
from _pytest.store import Store
from _pytest.pathlib import Path

if TYPE_CHECKING:
# Imported here due to circular import.
Expand Down Expand Up @@ -360,7 +361,7 @@ def _repr_failure_py(
truncate_locals = True

try:
abspath = os.getcwd() != str(self.config.invocation_dir)
abspath = Path(os.getcwd()) != Path(self.config.invocation_dir)
except OSError:
abspath = True

Expand Down

0 comments on commit 1256e42

Please sign in to comment.