1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Add functional tests for 'yanked' files

This commit is contained in:
Albert Tugushev 2019-09-24 19:32:01 +03:00
parent 828cbba70f
commit 1a3b84060d
3 changed files with 38 additions and 0 deletions

1
news/6653.trivial Normal file
View file

@ -0,0 +1 @@
Add functional tests for "yanked" files.

View file

@ -0,0 +1,7 @@
<html>
<body>
<a href="../../../packages/simple-1.0.tar.gz">simple-1.0.tar.gz</a>
<a href="../../../packages/simple-2.0.tar.gz">simple-2.0.tar.gz</a>
<a data-yanked="test reason message" href="../../../packages/simple-3.0.tar.gz">simple-3.0.tar.gz</a>
</body>
</html>

View file

@ -1657,3 +1657,33 @@ def test_install_pip_does_not_modify_pip_when_satisfied(
'pip', *install_args, use_module=use_module
)
assert expected_message in result.stdout, str(result)
def test_ignore_yanked_file(script, data):
"""
Test ignore a "yanked" file.
"""
result = script.pip(
'install', 'simple',
'--index-url', data.index_url('yanked'),
)
# Make sure a "yanked" release ignored
assert 'Successfully installed simple-2.0\n' in result.stdout, str(result)
def test_install_yanked_file_and_print_warning(script, data):
"""
Test install a "yanked" file and warn a reason.
Yanked files are always ignored, unless they are the only file that
matches a version specifier that "pins" to an exact version (PEP 592).
"""
result = script.pip(
'install', 'simple==3.0',
'--index-url', data.index_url('yanked'),
expect_stderr=True,
)
expected_warning = 'Reason for being yanked: test reason message'
assert expected_warning in result.stderr, str(result)
# Make sure a "yanked" release installed
assert 'Successfully installed simple-3.0\n' in result.stdout, str(result)