From 63897d345be62b6eda531979b9aa668a3661f8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 29 Sep 2023 23:14:54 +0200 Subject: [PATCH] Don't use legacy version numbers in tests --- tests/data/packages/README.txt | 6 +++--- .../{broken-0.2broken.tar.gz => broken-0.2.tar.gz} | Bin tests/functional/test_install_upgrade.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) rename tests/data/packages/{broken-0.2broken.tar.gz => broken-0.2.tar.gz} (100%) diff --git a/tests/data/packages/README.txt b/tests/data/packages/README.txt index aa957b337f0..4e044b7d19e 100644 --- a/tests/data/packages/README.txt +++ b/tests/data/packages/README.txt @@ -6,9 +6,9 @@ broken-0.1.tar.gz ----------------- This package exists for testing uninstall-rollback. -broken-0.2broken.tar.gz ------------------------ -Version 0.2broken has a setup.py crafted to fail on install (and only on +broken-0.2.tar.gz +----------------- +Version 0.2 has a setup.py crafted to fail on install (and only on install). If any earlier step would fail (i.e. egg-info-generation), the already-installed version would never be uninstalled, so uninstall-rollback would not come into play. diff --git a/tests/data/packages/broken-0.2broken.tar.gz b/tests/data/packages/broken-0.2.tar.gz similarity index 100% rename from tests/data/packages/broken-0.2broken.tar.gz rename to tests/data/packages/broken-0.2.tar.gz diff --git a/tests/functional/test_install_upgrade.py b/tests/functional/test_install_upgrade.py index 09c01d7eb18..16ef4dca5b2 100644 --- a/tests/functional/test_install_upgrade.py +++ b/tests/functional/test_install_upgrade.py @@ -288,17 +288,19 @@ def test_uninstall_rollback(script: PipTestEnvironment, data: TestData) -> None: crafted to fail on install). """ + # installing broken 0.1 succeeds result = script.pip("install", "-f", data.find_links, "--no-index", "broken==0.1") + # installing broken 0.2 fails because it's setup.py is broken result.did_create(script.site_packages / "broken.py") result2 = script.pip( "install", "-f", data.find_links, "--no-index", - "broken===0.2broken", + "broken===0.2", expect_error=True, ) - assert result2.returncode == 1, str(result2) + assert result2.returncode != 0, str(result2) assert ( script.run("python", "-c", "import broken; print(broken.VERSION)").stdout == "0.1\n"