Skip to content

Commit 367ca6a

Browse files
committed
Make double uninstall test independent of order
Discovery order depends on the metadata backend. For the importlib backend, it has changed following the previous commit, because now the .egg-link file is found while inspecting site-package, and the .egg directory is found after because it comes after in sys.path. Before the dedictated .egg detection logic was triggered while inspecting site package and found it, before looking for .egg-link.
1 parent d94adba commit 367ca6a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/functional/test_uninstall.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,6 @@ def test_uninstall_with_symlink(
628628
assert symlink_target.stat().st_mode == st_mode
629629

630630

631-
@pytest.mark.skipif(
632-
"sys.version_info >= (3, 14)",
633-
reason="Uninstall of .egg distributions not supported in Python 3.14+",
634-
)
635631
def test_uninstall_setuptools_develop_install(
636632
script: PipTestEnvironment, data: TestData
637633
) -> None:
@@ -642,11 +638,19 @@ def test_uninstall_setuptools_develop_install(
642638
script.assert_installed(FSPkg="0.1.dev0")
643639
# Uninstall both develop and install
644640
uninstall = script.pip("uninstall", "FSPkg", "-y")
645-
assert any(p.suffix == ".egg" for p in uninstall.files_deleted), str(uninstall)
646641
uninstall2 = script.pip("uninstall", "FSPkg", "-y")
647-
assert (
642+
# Depending on the metadata backend, the egg-link will be uninstalled first
643+
# or second, so we use xor in the assertions below.
644+
assert (join(script.site_packages, "FSPkg.egg-link") in uninstall.files_deleted) ^ (
648645
join(script.site_packages, "FSPkg.egg-link") in uninstall2.files_deleted
649-
), str(uninstall2)
646+
)
647+
assert any(
648+
p.name.startswith("FSPkg") and p.suffix == ".egg"
649+
for p in uninstall.files_deleted
650+
) ^ any(
651+
p.name.startswith("FSPkg") and p.suffix == ".egg"
652+
for p in uninstall2.files_deleted
653+
)
650654
script.assert_not_installed("FSPkg")
651655

652656

0 commit comments

Comments
 (0)