env.TESTS = Options.options.TESTS
env.SUBUNIT_FORMATTER = os.getenv('SUBUNIT_FORMATTER')
+
+ # Lots of test scripts need to run with the correct version
+ # of python. With the correct shebang the script should run with the
+ # correct version, the problem is that not all scripts are part
+ # of the installation, some scripts are part of the source code,
+ # and the shebang is not dynamically generated as yet.
+ # It is safer if we are somewhat version neutral at the moment and
+ # ignore the shebang and always run scripts from the test environment
+ # with the python version (determined by PYTHON env variable) If this
+ # env variable isn't set then set it according to the python version
+ # that is running the tests
+ if not os.getenv('PYTHON', None):
+ from sys import executable as exe
+ os.environ['PYTHON'] = os.path.basename(exe)
+
if not env.SUBUNIT_FORMATTER:
if Options.options.PERF_TEST:
env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit-json --prefix=${SELFTEST_PREFIX}'