summaryrefslogtreecommitdiffstats
path: root/testing/framework
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2022-05-30 18:28:57 (GMT)
committerMats Wichmann <mats@linux.com>2022-05-30 18:33:16 (GMT)
commit150197f2273fa639aa4815a68f9bcd38d3068a8d (patch)
treedb13d63507bc94b18732a214560f2c13fae4a8a2 /testing/framework
parentf230fd34892754bca67742e93aae471fd58133ec (diff)
downloadSCons-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.py6
-rw-r--r--testing/framework/TestCommonTests.py6
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)