diff options
author | William Deegan <bill@baddogconsulting.com> | 2015-12-16 22:43:40 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2015-12-16 22:43:40 (GMT) |
commit | 8617739fb8bfb9fee2252a02d47c5de220921ae4 (patch) | |
tree | a7966c1182e81ff03795b79e75f12adcbbd87dfb | |
parent | 8a198d3aa488dc02e77a87354a14fd6c5764184b (diff) | |
download | SCons-8617739fb8bfb9fee2252a02d47c5de220921ae4.zip SCons-8617739fb8bfb9fee2252a02d47c5de220921ae4.tar.gz SCons-8617739fb8bfb9fee2252a02d47c5de220921ae4.tar.bz2 |
don't run test for no threading via fake threading.py which throws ImportError on win32. on Win32 other modules import threading and so test fails. This was previously hidden by compat subprocess module which has been removed as obsolete since the base python is being moved to 2.7
-rw-r--r-- | test/option-j.py | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/test/option-j.py b/test/option-j.py index 3eb7bd3..69ef414 100644 --- a/test/option-j.py +++ b/test/option-j.py @@ -30,9 +30,11 @@ SConscript settable option. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import sys import TestSCons + _python_ = TestSCons._python_ try: @@ -120,42 +122,41 @@ test.fail_test(start2 < finish1) # succeeds. test.run(arguments='-j 2 out') +if sys.platform != 'win32': + # Test breaks on win32 when using real subprocess is not the only + # package to import threading + # + # Test that we fall back and warn properly if there's no threading.py + # module (simulated), which is the case if this version of Python wasn't + # built with threading support. -# Test that we fall back and warn properly if there's no threading.py -# module (simulated), which is the case if this version of Python wasn't -# built with threading support. + test.subdir('pythonlib') -test.subdir('pythonlib') + test.write(['pythonlib', 'threading.py'], "raise ImportError\n") -test.write(['pythonlib', 'threading.py'], """\ -raise ImportError -""") + save_pythonpath = os.environ.get('PYTHONPATH', '') + os.environ['PYTHONPATH'] = test.workpath('pythonlib') -save_pythonpath = os.environ.get('PYTHONPATH', '') -os.environ['PYTHONPATH'] = test.workpath('pythonlib') + #start2, finish1 = RunTest('-j 2 f1, f2', "fifth") -#start2, finish1 = RunTest('-j 2 f1, f2', "fifth") + test.write('f1.in', 'f1.in pythonlib\n') + test.write('f2.in', 'f2.in pythonlib\n') -test.write('f1.in', 'f1.in pythonlib\n') -test.write('f2.in', 'f2.in pythonlib\n') + test.run(arguments = "-j 2 f1 f2", stderr=None) -test.run(arguments = "-j 2 f1 f2", stderr=None) - -warn = \ -"""scons: warning: parallel builds are unsupported by this version of Python; -\tignoring -j or num_jobs option. -""" -test.must_contain_all_lines(test.stderr(), [warn]) + warn = """scons: warning: parallel builds are unsupported by this version of Python; +\tignoring -j or num_jobs option.""" + test.must_contain_all_lines(test.stderr(), [warn]) -str = test.read("f1") -start1,finish1 = list(map(float, str.split("\n"))) + str = test.read("f1") + start1,finish1 = list(map(float, str.split("\n"))) -str = test.read("f2") -start2,finish2 = list(map(float, str.split("\n"))) + str = test.read("f2") + start2,finish2 = list(map(float, str.split("\n"))) -test.fail_test(start2 < finish1) + test.fail_test(start2 < finish1) -os.environ['PYTHONPATH'] = save_pythonpath + os.environ['PYTHONPATH'] = save_pythonpath # Test SetJobs() with no -j: |