Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Restore the ability of the content-timestamp decider to see that a
a source which is a symlink has changed if the file-system target of
that link has been modified (issue #3880)
- Modernize a few tests that use now-deprecated unittest.getTestCaseNames
and unittest.makeSuite - Python itself suggests the replacements.

From Zhichang Yu:
- Added MSVC_USE_SCRIPT_ARGS variable to pass arguments to MSVC_USE_SCRIPT.
Expand Down
4 changes: 3 additions & 1 deletion SCons/Scanner/ScannerTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,9 @@ def suite():
ClassicCPPTestCase,
]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
loader = unittest.TestLoader()
loader.testMethodPrefix = 'test_'
names = loader.getTestCaseNames(tclass)
suite.addTests(list(map(tclass, names)))
return suite

Expand Down
4 changes: 3 additions & 1 deletion SCons/Tool/ToolTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def test_pathfind(self):


if __name__ == "__main__":
suite = unittest.makeSuite(ToolTestCase, 'test_')
loader = unittest.TestLoader()
loader.testMethodPrefix = 'test_'
suite = loader.loadTestsFromTestCase(ToolTestCase)
TestUnit.run(suite)

# Local Variables:
Expand Down
4 changes: 3 additions & 1 deletion SCons/Tool/msvsTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,9 @@ class msvsEmptyTestCase(msvsTestCase):
if k in os.environ:
del os.environ[k]

suite = unittest.makeSuite(test_class, 'test_')
loader = unittest.TestLoader()
loader.testMethodPrefix = 'test_'
suite = loader.loadTestsFromTestCase(test_class)
if not TestUnit.cli.get_runner()().run(suite).wasSuccessful():
exit_val = 1
finally:
Expand Down
4 changes: 3 additions & 1 deletion SCons/cppTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,9 @@ def scons_current_file(self, t):
fileTestCase,
]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
loader = unittest.TestLoader()
loader.testMethodPrefix = 'test_'
names = loader.getTestCaseNames(tclass)
try:
names = sorted(set(names))
except NameError:
Expand Down
6 changes: 4 additions & 2 deletions testing/framework/TestCmdTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3389,8 +3389,10 @@ def test_variables(self):
])
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)

Expand Down
6 changes: 4 additions & 2 deletions testing/framework/TestCommonTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2429,8 +2429,10 @@ def test_variables(self):
]
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)

Expand Down