diff options
author | Mats Wichmann <mats@linux.com> | 2021-11-11 15:12:01 -0700 |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-05-08 08:06:21 -0600 |
commit | aed512b9626a44e19b0368f241ca504cffa01a22 (patch) | |
tree | 37d356c89e334185d00617d0d9cb083db21844b5 /test/runtest/retry.py | |
parent | fcb92c4ff1503ac0cf920d26f771b8f47386f4dc (diff) | |
download | scons-git-aed512b9626a44e19b0368f241ca504cffa01a22.tar.gz |
Use pathlib in runtest
In the past, there have been some mismatches between how tests are
specified and how they are found. testlist files, excludelist files
and command-line specifications should be agnostic to operating system
conventions. For example, typing "runtest.py foo/bar" on windows
will produce paths like foo/bar\test.py, which is hard to match and
painful to read, it should obviously match discovered foo\bar\test.py.
Test information should be output using the native path separator for
consistency.
Using pathlib lets these be normalized - stored in a common format and
output in the expected format.
Adding this normalization of course broke some tests, which either
intentionally or through omission expected some portion of a path to
be UNIX-style. Specifically these five:
test\runtest\baseline\fail.py
test\runtest\baseline\no_result.py
test\runtest\simple\fail.py
test\runtest\simple\no_result.py
test\runtest\simple\pass.py
test\runtest\testargv.py
This was fixed and a general cleanup/reformat performed on the
runtest tests.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/runtest/retry.py')
-rw-r--r-- | test/runtest/retry.py | 22 |
1 files changed, 12 insertions, 10 deletions
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 |