Skip to content

Commit 23f6565

Browse files
committed
Fix CI: skip system-site assertion on in-tree builds (gh-128779)
site.py only adds site directories that exist on disk, so the system-site-packages assertion can only pass when the nominal install directories exist (e.g. with an installed Python). Skip that half on in-tree builds; the system_site_packages=False half is unaffected. Co-authored-by: Muse Code (Meta Muse Spark)
1 parent cd29bdf commit 23f6565

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎Lib/test/test_site.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,19 @@ def test_system_site_packages(self):
627627
self.assertNotIn(system_paths['purelib'], sys_path)
628628
self.assertNotIn(system_paths['platlib'], sys_path)
629629

630+
# site.py only adds site directories that exist on disk
631+
# (addsitedir guards on os.path.isdir), so the system
632+
# site-packages can only be detected when the directories exist,
633+
# e.g. with an installed Python. Skip on in-tree builds where the
634+
# nominal install directories were never created (gh-128779).
635+
system_site_packages = {system_paths['purelib'],
636+
system_paths['platlib']}
637+
if not all(map(os.path.isdir, system_site_packages)):
638+
self.skipTest(
639+
f"system site-packages directories do not exist: "
640+
f"{sorted(system_site_packages)}"
641+
)
642+
630643
with self.venv(system_site_packages=True) as venv:
631644
sys_path = json.loads(venv.run('-c', script).stdout)
632645
self.assertIn(system_paths['purelib'], sys_path)

0 commit comments

Comments
 (0)