summaryrefslogtreecommitdiffstats
path: root/test/runtest/simple
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/simple
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/simple')
-rw-r--r--test/runtest/simple/combined.py55
-rw-r--r--test/runtest/simple/fail.py33
-rw-r--r--test/runtest/simple/no_result.py31
-rw-r--r--test/runtest/simple/pass.py26
4 files changed, 55 insertions, 90 deletions
diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py
index 0c9997f..6794ea5 100644
--- a/test/runtest/simple/combined.py
+++ b/test/runtest/simple/combined.py
@@ -36,6 +36,7 @@ import TestRuntest
test = TestRuntest.TestRuntest()
+python = TestRuntest.python
test_fail_py = os.path.join('test', 'fail.py')
test_no_result_py = os.path.join('test', 'no_result.py')
test_pass_py = os.path.join('test', 'pass.py')
@@ -48,43 +49,31 @@ 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_stdout = """\
+%(python)s -tt test/fail.py
+FAILING TEST STDOUT
+%(python)s -tt test/no_result.py
+NO RESULT TEST STDOUT
+%(python)s -tt test/pass.py
+PASSING TEST STDOUT
-expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test
---- TEST RESULTS -------------------------------------------------------------
+Failed the following test:
+\ttest/fail.py
- %(test_fail_py)s : FAIL
-
- FAILING TEST STDOUT
-
- FAILING TEST STDERR
-
- %(test_no_result_py)s : NO_RESULT
-
- NO RESULT TEST STDOUT
-
- NO RESULT TEST STDERR
-
- %(test_pass_py)s : PASS
-
---- 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
+NO RESULT from the following test:
+\ttest/no_result.py
""" % locals()
-test.run(arguments = 'test', status = 1, stdout = expect)
+expect_stderr = """\
+FAILING TEST STDERR
+NO RESULT TEST STDERR
+PASSING TEST STDERR
+"""
+
+test.run(arguments='test',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py
index f060f50..4a36c47 100644
--- a/test/runtest/simple/fail.py
+++ b/test/runtest/simple/fail.py
@@ -30,36 +30,27 @@ Test how we handle a failing test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
test.subdir('test')
test.write_failing_test(['test', 'fail.py'])
-# NOTE: The "test/fail.py : FAIL" line has spaces at the end.
-
-expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/fail.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/fail.py : FAIL
-
- FAILING TEST STDOUT
-
- FAILING TEST STDERR
-
---- TESTS THAT DID NOT PASS --------------------------------------------------
-
- test/fail.py : FAIL
-
-
---- STATISTICS ---------------------------------------------------------------
-
- 1 tests total
+expect_stdout = """\
+%(python)s -tt test/fail.py
+FAILING TEST STDOUT
+""" % locals()
- 1 (100%) tests FAIL
+expect_stderr = """\
+FAILING TEST STDERR
"""
-test.run(arguments = 'test/fail.py', status = 1, stdout = expect)
+test.run(arguments='test/fail.py',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py
index 55d6f0e..475c5a8 100644
--- a/test/runtest/simple/no_result.py
+++ b/test/runtest/simple/no_result.py
@@ -30,34 +30,27 @@ Test how we handle a no-results test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
test.subdir('test')
test.write_no_result_test(['test', 'no_result.py'])
-expect = r"""qmtest run --output results.qmr --format none --result-stream="scons_tdb.AegisChangeStream" test/no_result.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/no_result.py : NO_RESULT
-
- NO RESULT TEST STDOUT
-
- NO RESULT TEST STDERR
-
---- TESTS THAT DID NOT PASS --------------------------------------------------
-
- test/no_result.py : NO_RESULT
-
-
---- STATISTICS ---------------------------------------------------------------
-
- 1 tests total
+expect_stdout = """\
+%(python)s -tt test/no_result.py
+NO RESULT TEST STDOUT
+""" % locals()
- 1 (100%) tests NO_RESULT
+expect_stderr = """\
+NO RESULT TEST STDERR
"""
-test.run(arguments = 'test/no_result.py', status = 1, stdout = expect)
+test.run(arguments='test/no_result.py',
+ status=2,
+ stdout=expect_stdout,
+ stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py
index ee7bc74..873be09 100644
--- a/test/runtest/simple/pass.py
+++ b/test/runtest/simple/pass.py
@@ -30,32 +30,24 @@ Test how we handle a passing test specified on the command line.
import TestRuntest
+python = TestRuntest.python
+
test = TestRuntest.TestRuntest()
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" test/pass.py
---- TEST RESULTS -------------------------------------------------------------
-
- test/pass.py : PASS
-
---- TESTS THAT DID NOT PASS --------------------------------------------------
-
- None.
-
-
---- STATISTICS ---------------------------------------------------------------
-
- 1 tests total
+expect_stdout = """\
+%(python)s -tt test/pass.py
+PASSING TEST STDOUT
+""" % locals()
- 1 (100%) tests PASS
+expect_stderr = """\
+PASSING TEST STDERR
"""
-test.run(arguments = 'test/pass.py', stdout = expect)
+test.run(arguments='test/pass.py', stdout=expect_stdout, stderr=expect_stderr)
test.pass_test()