summaryrefslogtreecommitdiffstats
path: root/test/runtest/print_time.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2009-12-16 07:07:13 (GMT)
committerSteven Knight <knight@baldmt.com>2009-12-16 07:07:13 (GMT)
commit2af84ec5c72b588ef67f8988d36066f2859c09a1 (patch)
tree76a5d74c1ecb5a1a17d53d89712d0264b1bfa5de /test/runtest/print_time.py
parent3f0d3576e54c5fdc1cb3822365a856736a96790e (diff)
downloadSCons-2af84ec5c72b588ef67f8988d36066f2859c09a1.zip
SCons-2af84ec5c72b588ef67f8988d36066f2859c09a1.tar.gz
SCons-2af84ec5c72b588ef67f8988d36066f2859c09a1.tar.bz2
Fix the tests of runtest.py now that QMTest is no longer being used
by default. Fix use of subprocess in Python 2.4+ and exit statuses of popen'ed scripts in earlier versions of Python. Support the ability to execute a directory's tests by naming the directory as a command- line argument.
Diffstat (limited to 'test/runtest/print_time.py')
-rw-r--r--test/runtest/print_time.py69
1 files changed, 28 insertions, 41 deletions
diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py
index 38a5bc6..54f90fe 100644
--- a/test/runtest/print_time.py
+++ b/test/runtest/print_time.py
@@ -35,6 +35,7 @@ import re
import TestCmd
import TestRuntest
+python = TestRuntest.python
test_fail_py = re.escape(os.path.join('test', 'fail.py'))
test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
test_pass_py = re.escape(os.path.join('test', 'pass.py'))
@@ -49,49 +50,35 @@ test.write_no_result_test(['test', 'no_result.py'])
test.write_passing_test(['test', 'pass.py'])
-# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both
-# have spaces at the end.
-
-expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream\(print_time='1'\)" test
---- TEST RESULTS -------------------------------------------------------------
-
- %(test_fail_py)s : FAIL
-
- FAILING TEST STDOUT
-
- FAILING TEST STDERR
-
- Total execution time: \d+\.\d+ seconds
-
- %(test_no_result_py)s : NO_RESULT
-
- NO RESULT TEST STDOUT
-
- NO RESULT TEST STDERR
-
- Total execution time: \d+\.\d+ seconds
-
- %(test_pass_py)s : PASS
-
- Total execution time: \d+\.\d+ seconds
-
---- TESTS THAT DID NOT PASS --------------------------------------------------
-
- %(test_fail_py)s : FAIL
-
- %(test_no_result_py)s : NO_RESULT
-
-
---- STATISTICS ---------------------------------------------------------------
-
- 3 tests total
-
- 1 \( 33%%\) tests PASS
- 1 \( 33%%\) tests FAIL
- 1 \( 33%%\) tests NO_RESULT
+expect_stdout = """\
+%(python)s -tt test/fail.py
+FAILING TEST STDOUT
+Test execution time: \\d+.\\d seconds
+%(python)s -tt test/no_result.py
+NO RESULT TEST STDOUT
+Test execution time: \\d+.\\d seconds
+%(python)s -tt test/pass.py
+PASSING TEST STDOUT
+Test execution time: \\d+.\\d seconds
+Total execution time for all tests: \\d+.\\d seconds
+
+Failed the following test:
+\ttest/fail.py
+
+NO RESULT from the following test:
+\ttest/no_result.py
""" % locals()
-test.run(arguments = '-t test', status = 1, stdout = expect)
+expect_stderr = """\
+FAILING TEST STDERR
+NO RESULT TEST STDERR
+PASSING TEST STDERR
+"""
+
+test.run(arguments='-t test',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()