Skip to content

Commit ad1b2d3

Browse files
committed
Use samefile instead == to compare to SRC_DIR
This resolves a behavioral different between Python 3.7 and 3.8+, where a == comparison would incorrectly compare Path against str and cause incorrect results.
1 parent 42359a9 commit ad1b2d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def scoped_global_tempdir_manager(request: pytest.FixtureRequest) -> Iterator[No
324324
def pip_src(tmpdir_factory: pytest.TempPathFactory) -> Path:
325325
def not_code_files_and_folders(path: str, names: List[str]) -> Iterable[str]:
326326
# In the root directory...
327-
if path == SRC_DIR:
327+
if os.path.samefile(path, SRC_DIR):
328328
# ignore all folders except "src"
329329
folders = {
330330
name for name in names if os.path.isdir(os.path.join(path, name))

0 commit comments

Comments
 (0)