Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog/5819.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Windows: Fix regression with conftest whose qualified name contains uppercase
characters (introduced by #5792).
3 changes: 1 addition & 2 deletions src/_pytest/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from os.path import expanduser
from os.path import expandvars
from os.path import isabs
from os.path import normcase
from os.path import sep
from posixpath import sep as posix_sep

Expand Down Expand Up @@ -343,4 +342,4 @@ def unique_path(path):

This is needed only for ``py.path.local``; ``pathlib.Path`` handles this
natively with ``resolve()``."""
return type(path)(normcase(str(path.realpath())))
return type(path)(Path(str(path)).resolve())
10 changes: 10 additions & 0 deletions testing/test_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ def test_conftest_badcase(testdir):
assert result.ret == ExitCode.NO_TESTS_COLLECTED


def test_conftest_uppercase(testdir):
"""Check conftest.py loading when directory casing is wrong."""
source = {"__init__.py": "", "Foo/conftest.py": "", "Foo/__init__.py": ""}
testdir.makepyfile(**source)

testdir.tmpdir.chdir()
result = testdir.runpytest()
assert result.ret == ExitCode.NO_TESTS_COLLECTED


def test_no_conftest(testdir):
testdir.makeconftest("assert 0")
result = testdir.runpytest("--noconftest")
Expand Down