summaryrefslogtreecommitdiffstats
path: root/test/scons-time
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2021-11-26 17:25:50 (GMT)
committerMats Wichmann <mats@linux.com>2021-11-26 18:16:59 (GMT)
commit9649d0fd2326d607ee545625cea45cf72aab87a6 (patch)
treef1dfbf812ca0624b9836a583d7da6c14af14d450 /test/scons-time
parentc335e187fb9b2c79fe03489c13cb7859969ed25c (diff)
downloadSCons-9649d0fd2326d607ee545625cea45cf72aab87a6.zip
SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.gz
SCons-9649d0fd2326d607ee545625cea45cf72aab87a6.tar.bz2
Fix tests to not hang on Windows with bad .py assoc
For systems where the association for .py files is not to an actual Python interpreter, those few cases where we need to run a Python script directly as a program don't work. This could be because the association was never set up, or because some other program (e.g. Visual Studio Code) has taken it over. In some cases may appear to "hang" because the alternate program is waiting for user interaction runtest.py now has a mechanism to check (thanks to Brett Cannon for providing this incantation). It isn't super precise (looks for the substring "py" in the queried association), but should work out. It sets an environment variable which the test framework can read and as a result set a flag which individual tests can read. Two tests in scons-time which had previously been set to skip-if-win32 now look at this flag instead. Three tests in sconsign now also look at this flag. This allows a clean run on my dev box with VS Code having taken over the .py association. Various things can break if the environment used to fire off Windows processes doesn't contain %UserProfile%. Added this to the short list of passthrough env vars. Apparently an environment without this value is now considered invalid (it blew up the erroneously launched VS Code, but we've apparently been lucky it hasn't blown up more things - believe there was also a report of a problem with the Visual Studio setup scripts). A little extra cleanup: - a couple of Py2-isms were cleaned out (Script/Main.py and in the test framework) - The paths to look for site-scons were rewritten (part of this was another Py2-ism), and the system path changed a bit - the old path is still checked, and the manpage updated to reflect this. - runtest.py dropped the unused whereis functions. - the three sconsign tests now use f-string formatting, mostly as an experiment to see how easy it is to convert. Fixes #4053 Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/scons-time')
-rw-r--r--test/scons-time/run/config/python.py10
-rw-r--r--test/scons-time/run/option/python.py11
2 files changed, 11 insertions, 10 deletions
diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py
index ac6d1e3..f1b8fb2 100644
--- a/test/scons-time/run/config/python.py
+++ b/test/scons-time/run/config/python.py
@@ -30,14 +30,14 @@ Verify specifying an alternate Python executable in a config file.
import os
import TestSCons_time
-from TestCmd import IS_WINDOWS
-_python_ = TestSCons_time._python_
+from TestCmd import NEED_HELPER
+from TestSCons_time import _python_
test = TestSCons_time.TestSCons_time()
-if IS_WINDOWS:
- # tests expect Windows file assoc to run my_python, not in our control.
- test.skip_test("Skipping test on win32 due to launch problems.")
+
+if NEED_HELPER:
+ test.skip_test("Test host cannot directly execute scripts, skipping test\n")
test.write_sample_project('foo.tar.gz')
diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py
index d117f2c..d10267a 100644
--- a/test/scons-time/run/option/python.py
+++ b/test/scons-time/run/option/python.py
@@ -30,14 +30,15 @@ Verify the run --python option to specify an alternatie Python executable.
import os
import TestSCons_time
-from TestCmd import IS_WINDOWS
-_python_ = TestSCons_time._python_
+from TestCmd import NEED_HELPER
+from TestCmd import IS_WINDOWS
+from TestSCons_time import _python_
test = TestSCons_time.TestSCons_time()
-if IS_WINDOWS:
- # tests expect Windows file assoc to run my_python, not in our control.
- test.skip_test("Skipping test on win32 due to launch problems.")
+
+if NEED_HELPER:
+ test.skip_test("Test host cannot directly execute scripts, skipping test\n")
test.write_sample_project('foo.tar.gz')