Skip to content

Commit 03490f9

Browse files
fix test failures
1 parent cdfe729 commit 03490f9

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

src/pip/_internal/cache.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,6 @@ def _get_candidates(
187187
if candidate.is_file():
188188
yield (candidate.name, path)
189189

190-
@abc.abstractmethod
191-
def get(
192-
self,
193-
link: Link,
194-
package_name: Optional[str],
195-
supported_tags: List[Tag],
196-
) -> Link:
197-
"""Returns a link to a cached item if it exists, otherwise returns the
198-
passed link.
199-
"""
200-
...
201-
202190

203191
class SimpleWheelCache(WheelCacheBase):
204192
"""A cache of wheels for future installs."""

src/pip/_internal/index/package_finder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,11 @@ def _write_http_cache_info(
903903
def _process_project_url_uncached(
904904
self, project_url: Link, link_evaluator: LinkEvaluator
905905
) -> List[InstallationCandidate]:
906+
logger.debug(
907+
"Fetching project page and analyzing links: %s",
908+
project_url,
909+
)
910+
906911
index_response = self._link_collector.fetch_response(project_url)
907912
if index_response is None:
908913
return []

tests/unit/test_collector.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_get_simple_response_archive_to_http_scheme(
9090

9191
session.assert_has_calls(
9292
[
93-
mock.call.head(url, allow_redirects=True),
93+
mock.call.head(url, allow_redirects=True, headers=None),
9494
]
9595
)
9696
mock_raise_for_status.assert_called_once_with(session.head.return_value)
@@ -152,7 +152,7 @@ def test_get_simple_response_archive_to_http_scheme_is_html(
152152

153153
assert resp is not None
154154
assert session.mock_calls == [
155-
mock.call.head(url, allow_redirects=True),
155+
mock.call.head(url, allow_redirects=True, headers=None),
156156
mock.call.get(
157157
url,
158158
headers={
@@ -240,14 +240,17 @@ def test_get_simple_response_dont_log_clear_text_password(
240240
assert resp is not None
241241
mock_raise_for_status.assert_called_once_with(resp)
242242

243-
assert len(caplog.records) == 2
243+
assert len(caplog.records) == 3
244244
record = caplog.records[0]
245245
assert record.levelname == "DEBUG"
246246
assert record.message.splitlines() == [
247247
"Getting page https://user:****@example.com/simple/",
248248
]
249249
record = caplog.records[1]
250250
assert record.levelname == "DEBUG"
251+
assert record.message.splitlines() == ["headers: None"]
252+
record = caplog.records[2]
253+
assert record.levelname == "DEBUG"
251254
assert record.message.splitlines() == [
252255
"Fetched page https://user:****@example.com/simple/ as text/html",
253256
]
@@ -838,7 +841,7 @@ def test_get_index_content_directory_append_index(tmpdir: Path) -> None:
838841
mock_func.return_value = fake_response
839842
actual = _get_index_content(Link(dir_url), session=session)
840843
assert mock_func.mock_calls == [
841-
mock.call(expected_url, session=session),
844+
mock.call(expected_url, headers=None, session=session),
842845
], f"actual calls: {mock_func.mock_calls}"
843846

844847
assert actual is not None
@@ -957,6 +960,7 @@ def test_fetch_response(self, mock_get_simple_response: mock.Mock) -> None:
957960
# _get_simple_response().
958961
mock_get_simple_response.assert_called_once_with(
959962
url,
963+
headers=None,
960964
session=link_collector.session,
961965
)
962966

0 commit comments

Comments
 (0)