diff options
author | Mats Wichmann <mats@linux.com> | 2022-05-30 18:28:57 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2022-05-30 18:33:16 (GMT) |
commit | 150197f2273fa639aa4815a68f9bcd38d3068a8d (patch) | |
tree | db13d63507bc94b18732a214560f2c13fae4a8a2 /testing/framework | |
parent | f230fd34892754bca67742e93aae471fd58133ec (diff) | |
download | SCons-150197f2273fa639aa4815a68f9bcd38d3068a8d.zip SCons-150197f2273fa639aa4815a68f9bcd38d3068a8d.tar.gz SCons-150197f2273fa639aa4815a68f9bcd38d3068a8d.tar.bz2 |
Fix some Py 3.11 depr warns in tests
A couple of unittest methods that a few SCons tests use have
been marked deprecated in Python 3.11, with replacements provided.
Partial fix for #4162, do not close just off this PR.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'testing/framework')
-rw-r--r-- | testing/framework/TestCmdTests.py | 6 | ||||
-rw-r--r-- | testing/framework/TestCommonTests.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/testing/framework/TestCmdTests.py b/testing/framework/TestCmdTests.py index 212c59a..3b29091 100644 --- a/testing/framework/TestCmdTests.py +++ b/testing/framework/TestCmdTests.py @@ -3389,8 +3389,10 @@ if __name__ == "__main__": ]) suite = unittest.TestSuite() for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests([ tclass(n) for n in names ]) + loader = unittest.TestLoader() + loader.testMethodPrefix = 'test_' + names = loader.getTestCaseNames(tclass) + suite.addTests([tclass(n) for n in names]) if not unittest.TextTestRunner().run(suite).wasSuccessful(): sys.exit(1) diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index 03a5508..dff7a50 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -2429,8 +2429,10 @@ if __name__ == "__main__": ] suite = unittest.TestSuite() for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests([ tclass(n) for n in names ]) + loader = unittest.TestLoader() + loader.testMethodPrefix = 'test_' + names = loader.getTestCaseNames(tclass) + suite.addTests([tclass(n) for n in names]) if not unittest.TextTestRunner().run(suite).wasSuccessful(): sys.exit(1) |