Test that the -P option lets us specify a Python version to use.
"""
-import os.path
+import os
+import re
if not hasattr(os.path, 'pardir'):
os.path.pardir = '..'
mypython = os.path.join(head, dir, os.path.pardir, dir, python)
-test.subdir('test')
-
-test.write_passing_test(['test', 'pass.py'])
-
-# NOTE: The "test/pass.py : PASS" line has spaces at the end.
-
-expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" --context python="%(mypython)s" test
---- TEST RESULTS -------------------------------------------------------------
-
- %(test_pass_py)s : PASS
+def escape(s):
+ return s.replace('\\', '\\\\')
---- TESTS THAT DID NOT PASS --------------------------------------------------
+if re.search('\s', mypython):
+ mypythonstring = '"%s"' % escape(mypython)
+else:
+ mypythonstring = escape(mypython)
- None.
-
-
---- STATISTICS ---------------------------------------------------------------
+test.subdir('test')
- 1 tests total
+test.write_passing_test(['test', 'pass.py'])
- 1 (100%%) tests PASS
+expect_stdout = """\
+%(mypythonstring)s -tt %(test_pass_py)s
+PASSING TEST STDOUT
""" % locals()
-test.run(arguments = ['-P', mypython, 'test'], stdout = expect)
+expect_stderr = """\
+PASSING TEST STDERR
+"""
+
+test.run(arguments=['-P', mypython, 'test'],
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()