2020-04-24 21:14:09 +02:00
|
|
|
from pip._internal.models.candidate import InstallationCandidate
|
|
|
|
from pip._internal.models.link import Link
|
|
|
|
|
|
|
|
|
|
|
|
def make_mock_candidate(version, yanked_reason=None, hex_digest=None):
|
2020-12-23 20:25:12 +01:00
|
|
|
url = f'https://example.com/pkg-{version}.tar.gz'
|
2020-04-24 21:14:09 +02:00
|
|
|
if hex_digest is not None:
|
|
|
|
assert len(hex_digest) == 64
|
2020-12-23 20:25:12 +01:00
|
|
|
url += f'#sha256={hex_digest}'
|
2020-04-24 21:14:09 +02:00
|
|
|
|
|
|
|
link = Link(url, yanked_reason=yanked_reason)
|
|
|
|
candidate = InstallationCandidate('mypackage', version, link)
|
|
|
|
|
|
|
|
return candidate
|