diff options
Diffstat (limited to 'test/runtest/xml/output.py')
-rw-r--r-- | test/runtest/xml/output.py | 32 |
1 files changed, 13 insertions, 19 deletions
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') |