Skip to content

Commit 4221c23

Browse files
pre-commit-ci[bot]sbidoul
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a84f7bf commit 4221c23

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

src/pip/_internal/req/req_uninstall.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ def from_dist(cls, dist: BaseDistribution) -> "UninstallPathSet":
539539
# above, so this only covers the setuptools-style editable.
540540
with open(develop_egg_link) as fh:
541541
link_pointer = os.path.normcase(fh.readline().strip())
542-
normalized_link_pointer = paths_to_remove._normalize_path_cached(link_pointer)
542+
normalized_link_pointer = paths_to_remove._normalize_path_cached(
543+
link_pointer
544+
)
543545
assert os.path.samefile(
544546
normalized_link_pointer, normalized_dist_location
545547
), (

tests/unit/test_req_uninstall.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ def in_tmpdir(paths: List[str]) -> List[str]:
129129

130130
class TestUninstallPathSet:
131131
def test_add(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
132-
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
132+
monkeypatch.setattr(
133+
pip._internal.req.req_uninstall.UninstallPathSet,
134+
"_permitted",
135+
mock_permitted,
136+
)
133137
# Fix case for windows tests
134138
file_extant = os.path.normcase(os.path.join(tmpdir, "foo"))
135139
file_nonexistent = os.path.normcase(os.path.join(tmpdir, "nonexistent"))
@@ -145,7 +149,11 @@ def test_add(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
145149
assert ups._paths == {file_extant}
146150

147151
def test_add_pth(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
148-
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
152+
monkeypatch.setattr(
153+
pip._internal.req.req_uninstall.UninstallPathSet,
154+
"_permitted",
155+
mock_permitted,
156+
)
149157
# Fix case for windows tests
150158
tmpdir = os.path.normcase(tmp_path)
151159
on_windows = sys.platform == "win32"
@@ -175,7 +183,11 @@ def test_add_pth(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
175183

176184
@pytest.mark.skipif("sys.platform == 'win32'")
177185
def test_add_symlink(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
178-
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
186+
monkeypatch.setattr(
187+
pip._internal.req.req_uninstall.UninstallPathSet,
188+
"_permitted",
189+
mock_permitted,
190+
)
179191
f = os.path.join(tmpdir, "foo")
180192
with open(f, "w"):
181193
pass
@@ -187,7 +199,11 @@ def test_add_symlink(self, tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> Non
187199
assert ups._paths == {foo_link}
188200

189201
def test_compact_shorter_path(self, monkeypatch: pytest.MonkeyPatch) -> None:
190-
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
202+
monkeypatch.setattr(
203+
pip._internal.req.req_uninstall.UninstallPathSet,
204+
"_permitted",
205+
mock_permitted,
206+
)
191207
monkeypatch.setattr("os.path.exists", lambda p: True)
192208
# This deals with nt/posix path differences
193209
short_path = os.path.normcase(
@@ -202,7 +218,11 @@ def test_compact_shorter_path(self, monkeypatch: pytest.MonkeyPatch) -> None:
202218
def test_detect_symlink_dirs(
203219
self, monkeypatch: pytest.MonkeyPatch, tmpdir: Path
204220
) -> None:
205-
monkeypatch.setattr(pip._internal.req.req_uninstall.UninstallPathSet, "_permitted", mock_permitted)
221+
monkeypatch.setattr(
222+
pip._internal.req.req_uninstall.UninstallPathSet,
223+
"_permitted",
224+
mock_permitted,
225+
)
206226

207227
# construct 2 paths:
208228
# tmpdir/dir/file

0 commit comments

Comments
 (0)