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 5ca92e9 commit cee62af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/_pytest/nodes.py
Expand Up @@ -29,6 +29,7 @@
from _pytest.mark.structures import NodeKeywords
from _pytest.outcomes import fail
from _pytest.outcomes import Failed
from _pytest.pathlib import Path
from _pytest.store import Store

if TYPE_CHECKING:
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 cee62af

Please sign in to comment.