summaryrefslogtreecommitdiffstats
path: root/test/runtest
diff options
context:
space:
mode:
Diffstat (limited to 'test/runtest')
-rw-r--r--test/runtest/SCons.py7
-rw-r--r--test/runtest/faillog.py (renamed from test/runtest/fallback.py)42
-rw-r--r--test/runtest/no_faillog.py (renamed from test/runtest/noqmtest.py)36
-rw-r--r--test/runtest/print_time.py4
-rw-r--r--test/runtest/python.py2
-rw-r--r--test/runtest/retry.py69
-rw-r--r--test/runtest/simple/combined.py25
-rw-r--r--test/runtest/testlistfile.py5
8 files changed, 111 insertions, 79 deletions
diff --git a/test/runtest/SCons.py b/test/runtest/SCons.py
index 9bc86e8..20c4c64 100644
--- a/test/runtest/SCons.py
+++ b/test/runtest/SCons.py
@@ -34,9 +34,7 @@ import os
import TestRuntest
test = TestRuntest.TestRuntest()
-
-test.subdir(['SCons'],
- ['SCons', 'suite'])
+test.subdir(['SCons'], ['SCons', 'suite'])
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
@@ -44,11 +42,8 @@ src_passTests_py = os.path.join('SCons', 'passTests.py')
src_suite_passTests_py = os.path.join('SCons', 'suite', 'passTests.py')
test.write_passing_test(['SCons', 'pass.py'])
-
test.write_passing_test(['SCons', 'passTests.py'])
-
test.write_passing_test(['SCons', 'suite', 'pass.py'])
-
test.write_passing_test(['SCons', 'suite', 'passTests.py'])
expect_stdout = """\
diff --git a/test/runtest/fallback.py b/test/runtest/faillog.py
index b137307..e2ca67e 100644
--- a/test/runtest/fallback.py
+++ b/test/runtest/faillog.py
@@ -25,68 +25,52 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Test that runtest.py falls back (with a warning) using --noqmtest
-if it can't find qmtest on the $PATH.
+Test a list of tests in failed_tests.log to run with the --retry option
"""
-import os
+import os.path
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_fail_py = os.path.join('test', 'fail.py')
+test_pass_py = os.path.join('test', 'pass.py')
test = TestRuntest.TestRuntest()
-
-# qmtest may be in more than one location in your path
-while test.where_is('qmtest'):
- qmtest=test.where_is('qmtest')
- dir = os.path.split(qmtest)[0]
- path = os.environ['PATH'].split(os.pathsep)
- path.remove(dir)
- os.environ['PATH'] = os.pathsep.join(path)
-
test.subdir('test')
-
-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')
-
test.write_failing_test(test_fail_py)
-test.write_no_result_test(test_no_result_py)
test.write_passing_test(test_pass_py)
expect_stdout = """\
%(pythonstring)s%(pythonflags)s %(test_fail_py)s
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_no_result_py)s
-NO RESULT TEST STDOUT
%(pythonstring)s%(pythonflags)s %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
\t%(test_fail_py)s
-
-NO RESULT from the following test:
-\t%(test_no_result_py)s
""" % locals()
expect_stderr = """\
FAILING TEST STDERR
-NO RESULT TEST STDERR
PASSING TEST STDERR
"""
testlist = [
test_fail_py,
- test_no_result_py,
test_pass_py,
]
-test.run(arguments = '-k '+' '.join(testlist),
- status = 1,
- stdout = expect_stdout,
- stderr = expect_stderr)
+test.run(
+ arguments='-k --faillog=fail.log %s' % ' '.join(testlist),
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
+test.must_exist('fail.log')
+test.must_contain('fail.log', test_fail_py)
+test.must_not_exist('failed_tests.log')
test.pass_test()
diff --git a/test/runtest/noqmtest.py b/test/runtest/no_faillog.py
index fcf7ac0..db17c8e 100644
--- a/test/runtest/noqmtest.py
+++ b/test/runtest/no_faillog.py
@@ -25,60 +25,54 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Test that by default tests are invoked directly via Python, not
-using qmtest.
+Test a list of tests in failed_tests.log to run with the --retry option
"""
-import os
+import os.path
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_fail_py = os.path.join('test', 'fail.py')
+test_pass_py = os.path.join('test', 'pass.py')
test = TestRuntest.TestRuntest()
-
test.subdir('test')
-
-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')
-
test.write_failing_test(test_fail_py)
-test.write_no_result_test(test_no_result_py)
test.write_passing_test(test_pass_py)
+test.write('failed_tests.log', """\
+%(test_fail_py)s
+""" % locals())
+
expect_stdout = """\
%(pythonstring)s%(pythonflags)s %(test_fail_py)s
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_no_result_py)s
-NO RESULT TEST STDOUT
%(pythonstring)s%(pythonflags)s %(test_pass_py)s
PASSING TEST STDOUT
Failed the following test:
\t%(test_fail_py)s
-
-NO RESULT from the following test:
-\t%(test_no_result_py)s
""" % locals()
expect_stderr = """\
FAILING TEST STDERR
-NO RESULT TEST STDERR
PASSING TEST STDERR
"""
testlist = [
test_fail_py,
- test_no_result_py,
test_pass_py,
]
-test.run(arguments = '-k %s' % ' '.join(testlist),
- status = 1,
- stdout = expect_stdout,
- stderr = expect_stderr)
+test.run(
+ arguments='-k --no-faillog %s' % ' '.join(testlist),
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
+test.must_not_exist('failing_tests.log')
test.pass_test()
diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py
index 322b88b..834d2ae 100644
--- a/test/runtest/print_time.py
+++ b/test/runtest/print_time.py
@@ -42,13 +42,9 @@ test_no_result_py = re.escape(os.path.join('test', 'no_result.py'))
test_pass_py = re.escape(os.path.join('test', 'pass.py'))
test = TestRuntest.TestRuntest(match = TestCmd.match_re)
-
test.subdir('test')
-
test.write_failing_test(['test', 'fail.py'])
-
test.write_no_result_test(['test', 'no_result.py'])
-
test.write_passing_test(['test', 'pass.py'])
expect_stdout = """\
diff --git a/test/runtest/python.py b/test/runtest/python.py
index da62378..499ab77 100644
--- a/test/runtest/python.py
+++ b/test/runtest/python.py
@@ -37,9 +37,7 @@ if not hasattr(os.path, 'pardir'):
import TestRuntest
test = TestRuntest.TestRuntest()
-
test_pass_py = os.path.join('test', 'pass.py')
-
head, python = os.path.split(TestRuntest.python)
head, dir = os.path.split(head)
diff --git a/test/runtest/retry.py b/test/runtest/retry.py
new file mode 100644
index 0000000..4280152
--- /dev/null
+++ b/test/runtest/retry.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test a list of tests in failed_tests.log to run with the --retry option
+"""
+
+import os.path
+
+import TestRuntest
+
+pythonstring = TestRuntest.pythonstring
+pythonflags = TestRuntest.pythonflags
+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')
+
+test = TestRuntest.TestRuntest()
+
+test.subdir('test')
+test.write_failing_test(['test', 'fail.py'])
+test.write_no_result_test(['test', 'no_result.py'])
+test.write_passing_test(['test', 'pass.py'])
+
+test.write('failed_tests.log', """\
+%(test_fail_py)s
+""" % locals())
+
+expect_stdout = """\
+%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+FAILING TEST STDOUT
+""" % locals()
+
+expect_stderr = """\
+FAILING TEST STDERR
+"""
+
+test.run(arguments='-k --retry', status=1, 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:
diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py
index ec0a1bb..a54e57c 100644
--- a/test/runtest/simple/combined.py
+++ b/test/runtest/simple/combined.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/env python
#
# __COPYRIGHT__
@@ -34,21 +33,17 @@ import os
import TestRuntest
-test = TestRuntest.TestRuntest()
-
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
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')
+test = TestRuntest.TestRuntest()
test.subdir('test')
-
-test.write_failing_test(['test', 'fail.py'])
-
-test.write_no_result_test(['test', 'no_result.py'])
-
-test.write_passing_test(['test', 'pass.py'])
+test.write_failing_test(test_fail_py)
+test.write_no_result_test(test_no_result_py)
+test.write_passing_test(test_pass_py)
expect_stdout = """\
%(pythonstring)s%(pythonflags)s %(test_fail_py)s
@@ -71,10 +66,14 @@ NO RESULT TEST STDERR
PASSING TEST STDERR
"""
-test.run(arguments='-k test',
- status=1,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='-k test',
+ status=1,
+ stdout=expect_stdout,
+ stderr=expect_stderr
+)
+test.must_exist('failed_tests.log')
+test.must_contain('failed_tests.log', test_fail_py)
test.pass_test()
diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py
index 063a8d0..5c956b8 100644
--- a/test/runtest/testlistfile.py
+++ b/test/runtest/testlistfile.py
@@ -26,10 +26,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test a list of tests to run in a file specified with the -f option.
+The commented-out test should not run.
"""
import os.path
-import re
import TestRuntest
@@ -42,11 +42,8 @@ test_pass_py = os.path.join('test', 'pass.py')
test = TestRuntest.TestRuntest()
test.subdir('test')
-
test.write_failing_test(['test', 'fail.py'])
-
test.write_no_result_test(['test', 'no_result.py'])
-
test.write_passing_test(['test', 'pass.py'])
test.write('t.txt', """\