Merge pull request #7080 from atugushev/yanked-files-functional-tests-6653

Add functional tests for 'yanked' files
This commit is contained in:
Christopher Hunt 2019-09-27 21:48:57 -04:00 committed by GitHub
commit 53072c508b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 is 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 print a warning.
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 is installed
assert 'Successfully installed simple-3.0\n' in result.stdout, str(result)