1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

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.
This commit is contained in:
Tzu-ping Chung 2022-06-12 12:19:14 +08:00
parent 42359a9605
commit ad1b2d31d0

View file

@ -324,7 +324,7 @@ def scoped_global_tempdir_manager(request: pytest.FixtureRequest) -> Iterator[No
def pip_src(tmpdir_factory: pytest.TempPathFactory) -> Path:
def not_code_files_and_folders(path: str, names: List[str]) -> Iterable[str]:
# In the root directory...
if path == SRC_DIR:
if os.path.samefile(path, SRC_DIR):
# ignore all folders except "src"
folders = {
name for name in names if os.path.isdir(os.path.join(path, name))