diff options
author | Steven Knight <knight@baldmt.com> | 2009-12-16 07:07:13 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-12-16 07:07:13 (GMT) |
commit | 2af84ec5c72b588ef67f8988d36066f2859c09a1 (patch) | |
tree | 76a5d74c1ecb5a1a17d53d89712d0264b1bfa5de /test/runtest/baseline | |
parent | 3f0d3576e54c5fdc1cb3822365a856736a96790e (diff) | |
download | SCons-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/baseline')
-rw-r--r-- | test/runtest/baseline/combined.py | 53 | ||||
-rw-r--r-- | test/runtest/baseline/fail.py | 31 | ||||
-rw-r--r-- | test/runtest/baseline/no_result.py | 29 | ||||
-rw-r--r-- | test/runtest/baseline/pass.py | 26 |
4 files changed, 57 insertions, 82 deletions
diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py index bd47908..02f3f53 100644 --- a/test/runtest/baseline/combined.py +++ b/test/runtest/baseline/combined.py @@ -34,6 +34,7 @@ import os.path import 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,41 +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 baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" 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 WITH UNEXPECTED OUTCOMES ------------------------------------------- - - %(test_no_result_py)s : NO_RESULT - - %(test_pass_py)s : PASS - - ---- STATISTICS --------------------------------------------------------------- - - 1 ( 33%%) tests as expected - 1 ( 33%%) tests unexpected PASS - 1 ( 33%%) tests unexpected NO_RESULT +NO RESULT from the following test: +\ttest/no_result.py """ % locals() -test.run(arguments = '-b . test', status = 1, stdout = expect) +expect_stderr = """\ +FAILING TEST STDERR +NO RESULT TEST STDERR +PASSING TEST STDERR +""" + +test.run(arguments='-b . test', + status=1, + stdout=expect_stdout, + stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py index bd52a18..fb7265e 100644 --- a/test/runtest/baseline/fail.py +++ b/test/runtest/baseline/fail.py @@ -30,34 +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 baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/fail.py ---- TEST RESULTS ------------------------------------------------------------- - - test/fail.py : FAIL - - FAILING TEST STDOUT - - FAILING TEST STDERR - ---- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- - - None. - - ---- STATISTICS --------------------------------------------------------------- +expect_stdout = """\ +%(python)s -tt test/fail.py +FAILING TEST STDOUT +""" % locals() - 1 (100%) tests as expected +expect_stderr = """\ +FAILING TEST STDERR """ -test.run(arguments = '-b . test/fail.py', status = 1, stdout = expect) +test.run(arguments='-b . test/fail.py', + status=1, + stdout=expect_stdout, + stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py index d1c0f75..8641c90 100644 --- a/test/runtest/baseline/no_result.py +++ b/test/runtest/baseline/no_result.py @@ -30,32 +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 baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/no_result.py ---- TEST RESULTS ------------------------------------------------------------- - - test/no_result.py : NO_RESULT - - NO RESULT TEST STDOUT - - NO RESULT TEST STDERR - ---- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- - - test/no_result.py : NO_RESULT - - ---- STATISTICS --------------------------------------------------------------- +expect_stdout = """\ +%(python)s -tt test/no_result.py +NO RESULT TEST STDOUT +""" % locals() - 1 (100%) tests unexpected NO_RESULT +expect_stderr = """\ +NO RESULT TEST STDERR """ -test.run(arguments = '-b . test/no_result.py', status = 1, stdout = expect) +test.run(arguments='-b . test/no_result.py', + status=2, + stdout=expect_stdout, + stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py index 3644052..ef3a99e 100644 --- a/test/runtest/baseline/pass.py +++ b/test/runtest/baseline/pass.py @@ -30,30 +30,26 @@ 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 baseline.qmr --format none --result-stream="scons_tdb.AegisBaselineStream" test/pass.py ---- TEST RESULTS ------------------------------------------------------------- - - test/pass.py : PASS - ---- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- - - test/pass.py : PASS - - ---- STATISTICS --------------------------------------------------------------- +expect_stdout = """\ +%(python)s -tt test/pass.py +PASSING TEST STDOUT +""" % locals() - 1 (100%) tests unexpected PASS +expect_stderr = """\ +PASSING TEST STDERR """ -test.run(arguments = '-b . test/pass.py', stdout = expect) +test.run(arguments='-b . test', + stdout=expect_stdout, + stderr=expect_stderr) test.pass_test() |