Move 2.0 changes collected in branches/pending back to trunk for further
[scons.git] / test / runtest / python.py
index 95b5f0f4f41dcd7884adc7d76585b01d9d52dca6..5c2f73775a42b361db7b769a6cc29c327b7a5ef5 100644 (file)
@@ -28,9 +28,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test that the -P option lets us specify a Python version to use.
 """
 
-import os.path
+import os
 import re
-import sys
 
 if not hasattr(os.path, 'pardir'):
     os.path.pardir = '..'
@@ -46,29 +45,35 @@ head, dir = os.path.split(head)
 
 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.py run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" --context python="%(mypython)s" test
---- TEST RESULTS -------------------------------------------------------------
-
-  %(test_pass_py)s                                  : PASS    
-
---- TESTS THAT DID NOT PASS --------------------------------------------------
+def escape(s):
+    return s.replace('\\', '\\\\')
 
-  None.
+if re.search('\s', mypython):
+    mypythonstring = '"%s"' % escape(mypython)
+else:
+    mypythonstring = escape(mypython)
 
+test.subdir('test')
 
---- STATISTICS ---------------------------------------------------------------
-
-       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()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: