Use a single log message.

This commit is contained in:
Chris Jerdonek 2019-09-21 10:39:25 -07:00
parent a2b2a24513
commit 7c00316268
2 changed files with 13 additions and 9 deletions

View File

@ -521,11 +521,14 @@ class LinkCollector(object):
]
url_locations = _remove_duplicate_links(url_locations)
logger.debug('%d location(s) to search for versions of %s:',
len(url_locations), project_name)
for location in url_locations:
logger.debug('* %s', location)
lines = [
'{} location(s) to search for versions of {}:'.format(
len(url_locations), project_name,
),
]
for link in url_locations:
lines.append('* {}'.format(link))
logger.debug('\n'.join(lines))
pages_links = {}
for page in self._get_pages(url_locations):

View File

@ -447,8 +447,9 @@ class TestLinkCollector(object):
'https://pypi.org/abc-1.0.tar.gz#md5=000000000'
)
actual = [record_tuple[1:] for record_tuple in caplog.record_tuples]
assert actual == [
(logging.DEBUG, '1 location(s) to search for versions of twine:'),
(logging.DEBUG, '* https://pypi.org/simple/twine/'),
expected_message = dedent("""\
1 location(s) to search for versions of twine:
* https://pypi.org/simple/twine/""")
assert caplog.record_tuples == [
('pip._internal.collector', logging.DEBUG, expected_message),
]