summaryrefslogtreecommitdiffstats
path: root/test/SWIG/SWIGPATH.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-01-29 19:37:08 (GMT)
committerMats Wichmann <mats@linux.com>2020-02-12 17:47:46 (GMT)
commit4814146dc3f69729e22f89078a5783a82e9df039 (patch)
tree9981cdd637b16dc1eeeb0c16405061540b15be15 /test/SWIG/SWIGPATH.py
parenteebcc30c898269ddb2fcfff846544a077059d10b (diff)
downloadSCons-4814146dc3f69729e22f89078a5783a82e9df039.zip
SCons-4814146dc3f69729e22f89078a5783a82e9df039.tar.gz
SCons-4814146dc3f69729e22f89078a5783a82e9df039.tar.bz2
test cleanups: use harness python
In a few places, a command line was built to execute a wrapper script written in Python, but the Python used was not the one used to invoke the test run (which is made available by TestSCons), but the result of running test.where_is('python'). On a system which still has the thing named 'python' resolve to Python 2, this fails, through no fault of scons itself. The two fixture wrapper scripts used occasionally by the tests used subprocess.call; this is considered "old" though not marked as deprecated at this time. Switched to subprocess.run. See: https://docs.python.org/3/library/subprocess.html#older-high-level-api One of these scripts was doing unnecessary bytes-twiddling. Modernized the inline myswig.py script (in test/SWIG/SWIG.py). This script was reformatted using Black along the way. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/SWIG/SWIGPATH.py')
-rw-r--r--test/SWIG/SWIGPATH.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/SWIG/SWIGPATH.py b/test/SWIG/SWIGPATH.py
index d516c0c..fcce4c2 100644
--- a/test/SWIG/SWIGPATH.py
+++ b/test/SWIG/SWIGPATH.py
@@ -35,13 +35,12 @@ test = TestSCons.TestSCons()
swig = test.where_is('swig')
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
+swig = swig.replace('\\','/')
-python = test.where_is('python')
-if not python:
- test,skip_test('Can not find installed "python", skipping test.\n')
+_python_ = TestSCons._python_
+
+test.file_fixture('wrapper.py')
-swig = swig.replace('\\','/')
-python = python.replace('\\','/')
test.subdir('inc1', 'inc2')
test.write(['inc2', 'dependency.i'], """\
@@ -59,7 +58,7 @@ foo = Environment(SWIGFLAGS='-python',
SWIG='%(swig)s',
SWIGPATH=['inc1', 'inc2'])
swig = foo.Dictionary('SWIG')
-bar = foo.Clone(SWIG = [r'%(python)s', 'wrapper.py', swig])
+bar = foo.Clone(SWIG = [r'%(_python_)s', 'wrapper.py', swig])
foo.CFile(target = 'dependent', source = ['dependent.i'])
""" % locals())
@@ -96,4 +95,4 @@ test.pass_test()
# tab-width:4
# indent-tabs-mode:nil
# End:
-# vim: set expandtab tabstop=4 shiftwidth=4: \ No newline at end of file
+# vim: set expandtab tabstop=4 shiftwidth=4: