From bbd63f972079491cd6df811dc51eda328c6444bb Mon Sep 17 00:00:00 2001 From: jay23606 Date: Tue, 10 Nov 2026 09:24:56 -0500 Subject: [PATCH] Address review feedback --- tests/release_linux_apprun_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/release_linux_apprun_test.py b/tests/release_linux_apprun_test.py index 8aaa7c7f..5a5c31c0 100644 --- a/tests/release_linux_apprun_test.py +++ b/tests/release_linux_apprun_test.py @@ -41,6 +41,16 @@ with tempfile.TemporaryDirectory() as tmp: shadow.mkdir(parents=True) (shadow / '__init__.py').write_text('# stands in for the PyPI "installer" package: no gui submodule\n') + # The test only means something if this interpreter would put the user site on sys.path without AppRun's + # setting. A venv has no user site, so run it with the system Python; otherwise the shadow is never tried. + probe_env = dict(env) + probe_env.pop('PYTHONNOUSERSITE', None) + probe = subprocess.run([sys.executable, '-c', 'import sys; print(sys.argv[1] in sys.path)', str(user_site)], + env=probe_env, capture_output=True, text=True, cwd=tmp) + assert probe.stdout.strip() == 'True', ( + f'user site {user_site} is not on sys.path for {sys.executable}; run this test with the system Python, ' + 'not a venv, or it cannot catch the shadowing') + bundle = tmp / 'bundle' (bundle / 'installer').mkdir(parents=True) (bundle / 'installer' / '__init__.py').write_text('')