[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-03-23 21:42:30 +00:00 committed by Stéphane Bidoul
parent a84f7bf0b0
commit 4221c23a2b
2 changed files with 28 additions and 6 deletions

View File

@ -539,7 +539,9 @@ class UninstallPathSet:
# above, so this only covers the setuptools-style editable.
with open(develop_egg_link) as fh:
link_pointer = os.path.normcase(fh.readline().strip())
normalized_link_pointer = paths_to_remove._normalize_path_cached(link_pointer)
normalized_link_pointer = paths_to_remove._normalize_path_cached(
link_pointer
)
assert os.path.samefile(
normalized_link_pointer, normalized_dist_location
), (

View File

@ -129,7 +129,11 @@ def test_compressed_listing(tmpdir: Path) -> None:
class TestUninstallPathSet:
def test_add(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
monkeypatch.setattr(
pip._internal.req.req_uninstall.UninstallPathSet,
"_permitted",
mock_permitted,
)
# Fix case for windows tests
file_extant = os.path.normcase(os.path.join(tmpdir, "foo"))
file_nonexistent = os.path.normcase(os.path.join(tmpdir, "nonexistent"))
@ -145,7 +149,11 @@ class TestUninstallPathSet:
assert ups._paths == {file_extant}
def test_add_pth(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
monkeypatch.setattr(
pip._internal.req.req_uninstall.UninstallPathSet,
"_permitted",
mock_permitted,
)
# Fix case for windows tests
tmpdir = os.path.normcase(tmp_path)
on_windows = sys.platform == "win32"
@ -175,7 +183,11 @@ class TestUninstallPathSet:
@pytest.mark.skipif("sys.platform == 'win32'")
def test_add_symlink(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
monkeypatch.setattr(
pip._internal.req.req_uninstall.UninstallPathSet,
"_permitted",
mock_permitted,
)
f = os.path.join(tmpdir, "foo")
with open(f, "w"):
pass
@ -187,7 +199,11 @@ class TestUninstallPathSet:
assert ups._paths == {foo_link}
def test_compact_shorter_path(self, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
monkeypatch.setattr(
pip._internal.req.req_uninstall.UninstallPathSet,
"_permitted",
mock_permitted,
)
monkeypatch.setattr("os.path.exists", lambda p: True)
# This deals with nt/posix path differences
short_path = os.path.normcase(
@ -202,7 +218,11 @@ class TestUninstallPathSet:
def test_detect_symlink_dirs(
self, monkeypatch: pytest.MonkeyPatch, tmpdir: Path
) -> None:
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
monkeypatch.setattr(
pip._internal.req.req_uninstall.UninstallPathSet,
"_permitted",
mock_permitted,
)
# construct 2 paths:
# tmpdir/dir/file