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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,6 +10,7 @@ __pycache__/
*.eggs
*.egg-info/
MANIFEST
pip-wheel-metadata/
Copy link
Member

Choose a reason for hiding this comment

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

We can drop this now, FWIW.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pip-wheel-metadata/


# Documentation
docs/build/
Expand Down
Empty file.
22 changes: 22 additions & 0 deletions tests/functional/test_check.py
@@ -1,3 +1,5 @@
import pytest

from tests.lib import create_test_package_with_setup


Expand Down Expand Up @@ -292,3 +294,23 @@ def test_check_include_work_dir_pkg(script):
)
assert matches_expected_lines(result.stdout, expected_lines)
assert result.returncode == 1


@pytest.mark.xfail(
reason='Not yet implemented: https://github.com/pypa/pip/pull/8633',
strict=True,
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add raises= arg here indicating what sort of exception is currently expected to happen?

I guess it's some kind of a subprocess error, right?

)
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)

"""Ensure that pip check detects a missing file post-install."""
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

(script.site_packages_path / "piptestpackage/__init__.py").unlink()

result = script.pip('check --integrity', expect_error=True)
expected_lines = (
"piptestpackage is missing the __init__.py file",
)
assert matches_expected_lines(result.stdout, expected_lines)
assert result.returncode == 1