From c751bcaf23c52ca40589ad8ee82543a21521f851 Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Sun, 26 Jul 2020 19:04:53 -0300 Subject: [PATCH 1/8] Add a failing test case for a future check flag This commit adds a testing case for issue #8579 --- tests/functional/test_check.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index 4e9a144bf02..76da76d9854 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -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): + """ + Work-in-progress failing test for a flag that detects broken packages + """ + 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() + + result = script.pip('check --integrity') + expected_lines = ( + "piptestpackage is missing the __init__.py file", + ) + assert matches_expected_lines(result.stdout, expected_lines) + assert result.returncode == 1 From ae8bcacf5f3d54119c15356ff685db13aeb2fcdf Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Sun, 26 Jul 2020 19:25:31 -0300 Subject: [PATCH 2/8] Update tests/functional/test_check.py docstring Co-authored-by: Sviatoslav Sydorenko --- tests/functional/test_check.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index 76da76d9854..ade3843e923 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -295,9 +295,7 @@ def test_check_include_work_dir_pkg(script): def test_check_integrity_errors_on_missing_files(data, script, tmpdir): - """ - Work-in-progress failing test for a flag that detects broken packages - """ + """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 From f4cf16d5e3a151159ce9534ccabcc48e41c8007a Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Sun, 26 Jul 2020 19:46:41 -0300 Subject: [PATCH 3/8] Mark tests/functional/test_check.py as expected fail While the feature is not fully developed, this test is expected to fail Co-authored-by: Sviatoslav Sydorenko --- tests/functional/test_check.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index ade3843e923..9fc6a1421a2 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -294,6 +294,10 @@ def test_check_include_work_dir_pkg(script): assert result.returncode == 1 +@pytest.mark.xfail( + reason='Not yet implemented: https://github.com/pypa/pip/pull/8633', + strict=True, +) def test_check_integrity_errors_on_missing_files(data, script, tmpdir): """Ensure that pip check detects a missing file post-install.""" to_install = data.packages.joinpath("pip-test-package-0.1.tar.gz") From 8227dcdeaf4ae3b8e7ffef44cccc6701ffd95a78 Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Sun, 26 Jul 2020 20:25:01 -0300 Subject: [PATCH 4/8] Update tests/functional/test_check.py Co-authored-by: Sviatoslav Sydorenko --- tests/functional/test_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index 9fc6a1421a2..4ee14343346 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -307,7 +307,7 @@ def test_check_integrity_errors_on_missing_files(data, script, tmpdir): target = script.site_packages_path / "piptestpackage/__init__.py" target.unlink() - result = script.pip('check --integrity') + result = script.pip('check --integrity', expect_error=True) expected_lines = ( "piptestpackage is missing the __init__.py file", ) From d0d6d91d3b5dfd6f0d2dbd27191be0ffcf8cf46e Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Sun, 26 Jul 2020 20:25:38 -0300 Subject: [PATCH 5/8] Update tests/functional/test_check.py Co-authored-by: Sviatoslav Sydorenko --- tests/functional/test_check.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index 4ee14343346..c17f9fd937b 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -304,8 +304,7 @@ def test_check_integrity_errors_on_missing_files(data, script, tmpdir): 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() + (script.site_packages_path / "piptestpackage/__init__.py").unlink() result = script.pip('check --integrity', expect_error=True) expected_lines = ( From b3327e87ccb3f612b14c0ccd3676a5b9253434ad Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Mon, 10 Aug 2020 10:30:10 -0300 Subject: [PATCH 6/8] Fix test_check pytest import --- tests/functional/test_check.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/test_check.py b/tests/functional/test_check.py index c17f9fd937b..6922370afb7 100644 --- a/tests/functional/test_check.py +++ b/tests/functional/test_check.py @@ -1,3 +1,5 @@ +import pytest + from tests.lib import create_test_package_with_setup From ce610442709d703d319e77770ed834caa728a8c2 Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Mon, 10 Aug 2020 10:33:59 -0300 Subject: [PATCH 7/8] Gitignore wheel metadata --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 946385eef5e..914c7e4a32e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ *.eggs *.egg-info/ MANIFEST +pip-wheel-metadata/ # Documentation docs/build/ From 9a00373a942ff0e5b10141778f6e8c4f31bf638d Mon Sep 17 00:00:00 2001 From: Felipe Rodrigues Date: Mon, 10 Aug 2020 10:35:10 -0300 Subject: [PATCH 8/8] Add trivial NEWS entry --- news/ad358afd-c8c7-4064-bbd8-75acc15b8408.trivial | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 news/ad358afd-c8c7-4064-bbd8-75acc15b8408.trivial diff --git a/news/ad358afd-c8c7-4064-bbd8-75acc15b8408.trivial b/news/ad358afd-c8c7-4064-bbd8-75acc15b8408.trivial new file mode 100644 index 00000000000..e69de29bb2d