summaryrefslogtreecommitdiff
path: root/test/runtest
diff options
context:
space:
mode:
Diffstat (limited to 'test/runtest')
-rw-r--r--test/runtest/SCons.py17
-rw-r--r--test/runtest/baseline/combined.py29
-rw-r--r--test/runtest/baseline/fail.py27
-rw-r--r--test/runtest/baseline/no_result.py38
-rw-r--r--test/runtest/baseline/pass.py17
-rw-r--r--test/runtest/faillog.py17
-rw-r--r--test/runtest/no_faillog.py26
-rw-r--r--test/runtest/print_time.py28
-rw-r--r--test/runtest/python.py25
-rw-r--r--test/runtest/retry.py22
-rw-r--r--test/runtest/simple/combined.py28
-rw-r--r--test/runtest/simple/fail.py25
-rw-r--r--test/runtest/simple/no_result.py31
-rw-r--r--test/runtest/simple/pass.py18
-rw-r--r--test/runtest/testargv.py42
-rw-r--r--test/runtest/testlistfile.py24
-rw-r--r--test/runtest/xml/output.py32
17 files changed, 217 insertions, 229 deletions
diff --git a/test/runtest/SCons.py b/test/runtest/SCons.py
index 20c4c6418..fc4c3e06c 100644
--- a/test/runtest/SCons.py
+++ b/test/runtest/SCons.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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__"
"""
Verify that we find tests under the SCons/ tree only if they end
@@ -46,17 +45,17 @@ 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 = """\
-%(pythonstring)s%(pythonflags)s %(src_passTests_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {src_passTests_py}
PASSING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(src_suite_passTests_py)s
+{pythonstring}{pythonflags} {src_suite_passTests_py}
PASSING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
PASSING TEST STDERR
PASSING TEST STDERR
-""" % locals()
+"""
test.run(arguments='-k SCons', stdout=expect_stdout, stderr=expect_stderr)
diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py
index 228d42d1a..00ce85bdf 100644
--- a/test/runtest/baseline/combined.py
+++ b/test/runtest/baseline/combined.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 combination of a passing test, failing test, and no-result
@@ -42,27 +41,24 @@ 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'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_no_result_py)s
+{pythonstring}{pythonflags} {test_no_result_py}
NO RESULT TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
Failed the following test:
-\t%(test_fail_py)s
+\t{test_fail_py}
NO RESULT from the following test:
-\t%(test_no_result_py)s
-""" % locals()
+\t{test_no_result_py}
+"""
expect_stderr = """\
FAILING TEST STDERR
@@ -70,10 +66,7 @@ NO RESULT TEST STDERR
PASSING TEST STDERR
"""
-test.run(arguments='-k -b . test',
- status=1,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(arguments='-k -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 e2aff4a22..2268dce84 100644
--- a/test/runtest/baseline/fail.py
+++ b/test/runtest/baseline/fail.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,38 +22,39 @@
# 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 how we handle a failing test specified on the command line.
"""
+import os
+
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_fail_py = os.path.join('test', 'fail.py')
test = TestRuntest.TestRuntest()
test.subdir('test')
-
test.write_failing_test(['test', 'fail.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s test/fail.py
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
FAILING TEST STDERR
"""
-test.run(arguments='-k -b . test/fail.py',
- status=1,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='-k -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 d00f5364f..ce6f20cbb 100644
--- a/test/runtest/baseline/no_result.py
+++ b/test/runtest/baseline/no_result.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,43 +22,45 @@
# 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 how we handle a no-results test specified on the command line.
"""
+import os
+
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_no_result_py = os.path.join('test', 'no_result.py')
test = TestRuntest.TestRuntest()
-
test.subdir('test')
-
test.write_no_result_test(['test', 'no_result.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s test/no_result.py
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_no_result_py}
NO RESULT TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
NO RESULT TEST STDERR
"""
-test.run(arguments='--no-ignore-skips -k -b . test/no_result.py',
- status=2,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='--no-ignore-skips -k -b . test/no_result.py',
+ status=2,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
-test.run(arguments='-k -b . test/no_result.py',
- status=0,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='-k -b . test/no_result.py',
+ status=0,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
test.pass_test()
diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py
index 481fc9791..c31a6d6a8 100644
--- a/test/runtest/baseline/pass.py
+++ b/test/runtest/baseline/pass.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 how we handle a passing test specified on the command line.
@@ -42,18 +41,16 @@ test.subdir('test')
test.write_passing_test(['test', 'pass.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
PASSING TEST STDERR
"""
-test.run(arguments='-k -b . test',
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(arguments='-k -b . test', stdout=expect_stdout, stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/faillog.py b/test/runtest/faillog.py
index e2ca67e63..f23b90bc7 100644
--- a/test/runtest/faillog.py
+++ b/test/runtest/faillog.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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
@@ -42,15 +41,15 @@ test.subdir('test')
test.write_failing_test(test_fail_py)
test.write_passing_test(test_pass_py)
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
Failed the following test:
-\t%(test_fail_py)s
-""" % locals()
+\t{test_fail_py}
+"""
expect_stderr = """\
FAILING TEST STDERR
diff --git a/test/runtest/no_faillog.py b/test/runtest/no_faillog.py
index db17c8edf..174ab48c9 100644
--- a/test/runtest/no_faillog.py
+++ b/test/runtest/no_faillog.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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
@@ -42,19 +41,22 @@ test.subdir('test')
test.write_failing_test(test_fail_py)
test.write_passing_test(test_pass_py)
-test.write('failed_tests.log', """\
-%(test_fail_py)s
-""" % locals())
+test.write(
+ 'failed_tests.log',
+ f"""\
+{test_fail_py}
+""",
+)
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
Failed the following test:
-\t%(test_fail_py)s
-""" % locals()
+\t{test_fail_py}
+"""
expect_stderr = """\
FAILING TEST STDERR
diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py
index 834d2ae45..3d49a9702 100644
--- a/test/runtest/print_time.py
+++ b/test/runtest/print_time.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 combination of a passing test, failing test, and no-result
@@ -41,30 +40,30 @@ 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'))
-test = TestRuntest.TestRuntest(match = TestCmd.match_re)
+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 = """\
-%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
Test execution time: \\d+.\\d seconds
-%(pythonstring)s%(pythonflags)s %(test_no_result_py)s
+{pythonstring}{pythonflags} {test_no_result_py}
NO RESULT TEST STDOUT
Test execution time: \\d+.\\d seconds
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+{pythonstring}{pythonflags} {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:
-\t%(test_fail_py)s
+\t{test_fail_py}
NO RESULT from the following test:
-\t%(test_no_result_py)s
-""" % locals()
+\t{test_no_result_py}
+"""
expect_stderr = """\
FAILING TEST STDERR
@@ -72,10 +71,7 @@ NO RESULT TEST STDERR
PASSING TEST STDERR
"""
-test.run(arguments='-k -t test',
- status=1,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(arguments='-k -t test', status=1, stdout=expect_stdout, stderr=expect_stderr)
test.pass_test()
diff --git a/test/runtest/python.py b/test/runtest/python.py
index abd4f0cba..dbb24ca1a 100644
--- a/test/runtest/python.py
+++ b/test/runtest/python.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 that the -P option lets us specify a Python version to use.
@@ -46,26 +45,26 @@ head, dir = os.path.split(head)
# python version then in use, which could be different
pythonflags = TestRuntest.pythonflags
-# We have to normalize the python path here, because some installations don't like
-# getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop.
+# We have to normalize the python path here, because some installations
+# don't like getting called with "/bin/../bin/python" as first argument,
+# e.g. Fedora 17 Desktop.
mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python))
test.subdir('test')
-
test.write_passing_test(['test', 'pass.py'])
-expect_stdout = """\
-%(mypython)s%(pythonflags)s %(test_pass_py)s
+expect_stdout = f"""\
+{mypython}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
PASSING TEST STDERR
"""
-test.run(arguments=['-k','-P', mypython, 'test'],
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments=['-k', '-P', mypython, 'test'], stdout=expect_stdout, stderr=expect_stderr
+)
test.pass_test()
diff --git a/test/runtest/retry.py b/test/runtest/retry.py
index 4280152db..0c5beb694 100644
--- a/test/runtest/retry.py
+++ b/test/runtest/retry.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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
@@ -45,14 +44,17 @@ 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())
+test.write(
+ 'failed_tests.log',
+ f"""\
+{test_fail_py}
+""",
+)
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_fail_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
FAILING TEST STDERR
diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py
index a54e57c12..e594c5048 100644
--- a/test/runtest/simple/combined.py
+++ b/test/runtest/simple/combined.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 combination of a passing test, failing test, and no-result
@@ -45,20 +44,20 @@ 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
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_no_result_py)s
+{pythonstring}{pythonflags} {test_no_result_py}
NO RESULT TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
Failed the following test:
-\t%(test_fail_py)s
+\t{test_fail_py}
NO RESULT from the following test:
-\t%(test_no_result_py)s
-""" % locals()
+\t{test_no_result_py}
+"""
expect_stderr = """\
FAILING TEST STDERR
@@ -66,12 +65,7 @@ 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)
diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py
index f26f00e9a..5e1979a1b 100644
--- a/test/runtest/simple/fail.py
+++ b/test/runtest/simple/fail.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,38 +22,35 @@
# 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 how we handle a failing test specified on the command line.
"""
+import os
+
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_fail_py = os.path.join('test', 'fail.py')
test = TestRuntest.TestRuntest()
-
test.subdir('test')
-
test.write_failing_test(['test', 'fail.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s test/fail.py
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_fail_py}
FAILING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
FAILING TEST STDERR
"""
-test.run(arguments='-k test/fail.py',
- status=1,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='-k 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 33f28e4a9..beb82b01c 100644
--- a/test/runtest/simple/no_result.py
+++ b/test/runtest/simple/no_result.py
@@ -27,35 +27,40 @@
Test how we handle a no-results test specified on the command line.
"""
+import os
+
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_no_result_py = os.path.join('test', 'no_result.py')
test = TestRuntest.TestRuntest()
-
test.subdir('test')
-
test.write_no_result_test(['test', 'no_result.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s test/no_result.py
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_no_result_py}
NO RESULT TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
NO RESULT TEST STDERR
"""
-test.run(arguments='--no-ignore-skips -k test/no_result.py',
- status=2,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='--no-ignore-skips -k test/no_result.py',
+ status=2,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
-test.run(arguments='-k test/no_result.py',
- status=0,
- stdout=expect_stdout,
- stderr=expect_stderr)
+test.run(
+ arguments='-k test/no_result.py',
+ status=0,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
test.pass_test()
diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py
index 7ceb9a054..408ef4c28 100644
--- a/test/runtest/simple/pass.py
+++ b/test/runtest/simple/pass.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,29 +22,27 @@
# 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 how we handle a passing test specified on the command line.
"""
+import os
+
import TestRuntest
pythonstring = TestRuntest.pythonstring
pythonflags = TestRuntest.pythonflags
+test_pass_py = os.path.join('test', 'pass.py')
test = TestRuntest.TestRuntest()
-
test.subdir('test')
-
test.write_passing_test(['test', 'pass.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s test/pass.py
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
PASSING TEST STDERR
diff --git a/test/runtest/testargv.py b/test/runtest/testargv.py
index 22e57e83b..20dcdc848 100644
--- a/test/runtest/testargv.py
+++ b/test/runtest/testargv.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 subdir args for runtest.py, for example:
@@ -38,34 +37,35 @@ import TestRuntest
test = TestRuntest.TestRuntest()
test.subdir('test', ['test', 'subdir'])
-files = {}
-files['pythonstring'] = TestRuntest.pythonstring
-files['pythonflags'] = TestRuntest.pythonflags
+pythonstring = TestRuntest.pythonstring
+pythonflags = TestRuntest.pythonflags
-files['one'] = os.path.join('test/subdir', 'test_one.py')
-files['two'] = os.path.join('test/subdir', 'two.py')
-files['three'] = os.path.join('test', 'test_three.py')
+one = os.path.join('test', 'subdir', 'test_one.py')
+two = os.path.join('test', 'subdir', 'two.py')
+three = os.path.join('test', 'test_three.py')
-test.write_passing_test(files['one'])
-test.write_passing_test(files['two'])
-test.write_passing_test(files['three'])
+test.write_passing_test(['test', 'subdir', 'test_one.py'])
+test.write_passing_test(['test', 'subdir', 'two.py'])
+test.write_passing_test(['test', 'test_three.py'])
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(one)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {one}
PASSING TEST STDOUT
-%(pythonstring)s%(pythonflags)s %(two)s
+{pythonstring}{pythonflags} {two}
PASSING TEST STDOUT
-""" % files
+"""
expect_stderr = """\
PASSING TEST STDERR
PASSING TEST STDERR
"""
-test.run(arguments = '--no-progress test/subdir',
- status = 0,
- stdout = expect_stdout,
- stderr = expect_stderr)
+test.run(
+ arguments='--no-progress test/subdir',
+ status=0,
+ stdout=expect_stdout,
+ stderr=expect_stderr,
+)
test.pass_test()
diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py
index 5c956b8e3..e5d85b8dc 100644
--- a/test/runtest/testlistfile.py
+++ b/test/runtest/testlistfile.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 to run in a file specified with the -f option.
@@ -46,15 +45,18 @@ 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', """\
-#%(test_fail_py)s
-%(test_pass_py)s
-""" % locals())
+test.write(
+ 't.txt',
+ f"""\
+#{test_fail_py}
+{test_pass_py}
+""",
+)
-expect_stdout = """\
-%(pythonstring)s%(pythonflags)s %(test_pass_py)s
+expect_stdout = f"""\
+{pythonstring}{pythonflags} {test_pass_py}
PASSING TEST STDOUT
-""" % locals()
+"""
expect_stderr = """\
PASSING TEST STDERR
diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py
index cd20dbdf9..66ec6562b 100644
--- a/test/runtest/xml/output.py
+++ b/test/runtest/xml/output.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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 writing XML output to a file.
@@ -34,8 +33,7 @@ import re
import TestCmd
import TestRuntest
-test = TestRuntest.TestRuntest(match = TestCmd.match_re,
- diff = TestCmd.diff_re)
+test = TestRuntest.TestRuntest(match=TestCmd.match_re, diff=TestCmd.diff_re)
pythonstring = re.escape(TestRuntest.pythonstring)
pythonflags = TestRuntest.pythonflags
@@ -44,22 +42,18 @@ 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.subdir('test')
-
test.write_fake_scons_source_tree()
-
test.write_failing_test(['test', 'fail.py'])
-
test.write_no_result_test(['test', 'no_result.py'])
-
test.write_passing_test(['test', 'pass.py'])
-test.run(arguments = '--xml xml.out test', status=1)
+test.run(arguments='--xml xml.out test', status=1)
-expect = """\
+expect = f"""\
<results>
<test>
- <file_name>%(test_fail_py)s</file_name>
- <command_line>%(pythonstring)s%(pythonflags)s %(test_fail_py)s</command_line>
+ <file_name>{test_fail_py}</file_name>
+ <command_line>{pythonstring}{pythonflags} {test_fail_py}</command_line>
<exit_status>1</exit_status>
<stdout>FAILING TEST STDOUT
</stdout>
@@ -68,8 +62,8 @@ expect = """\
<time>\\d+\\.\\d</time>
</test>
<test>
- <file_name>%(test_no_result_py)s</file_name>
- <command_line>%(pythonstring)s%(pythonflags)s %(test_no_result_py)s</command_line>
+ <file_name>{test_no_result_py}</file_name>
+ <command_line>{pythonstring}{pythonflags} {test_no_result_py}</command_line>
<exit_status>2</exit_status>
<stdout>NO RESULT TEST STDOUT
</stdout>
@@ -78,8 +72,8 @@ expect = """\
<time>\\d+\\.\\d</time>
</test>
<test>
- <file_name>%(test_pass_py)s</file_name>
- <command_line>%(pythonstring)s%(pythonflags)s %(test_pass_py)s</command_line>
+ <file_name>{test_pass_py}</file_name>
+ <command_line>{pythonstring}{pythonflags} {test_pass_py}</command_line>
<exit_status>0</exit_status>
<stdout>PASSING TEST STDOUT
</stdout>
@@ -89,7 +83,7 @@ expect = """\
</test>
<time>\\d+\\.\\d</time>
</results>
-""" % locals()
+"""
# Just strip carriage returns so the regular expression matching works.
contents = test.read('xml.out')