Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a testing case for a future check integrity flag #8633

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions tests/functional/test_check.py
Expand Up @@ -292,3 +292,22 @@ def test_check_include_work_dir_pkg(script):
)
assert matches_expected_lines(result.stdout, expected_lines)
assert result.returncode == 1


def test_check_integrity_errors_on_missing_files(data, script, tmpdir):
fbidu marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, this is a negative test. It's probably reasonable to add a positive test too (for when the integrity is fine)

"""
Work-in-progress failing test for a flag that detects broken packages
"""
fbidu marked this conversation as resolved.
Show resolved Hide resolved
to_install = data.packages.joinpath("pip-test-package-0.1.tar.gz")
result = script.pip_install_local(to_install)
assert 'Successfully installed pip-test-package' in result.stdout

target = script.site_packages_path / "piptestpackage/__init__.py"
target.unlink()
fbidu marked this conversation as resolved.
Show resolved Hide resolved

result = script.pip('check --integrity')
fbidu marked this conversation as resolved.
Show resolved Hide resolved
expected_lines = (
"piptestpackage is missing the __init__.py file",
)
assert matches_expected_lines(result.stdout, expected_lines)
assert result.returncode == 1