diff options
author | Mats Wichmann <mats@linux.com> | 2020-08-18 18:59:47 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-08-25 13:34:57 (GMT) |
commit | a4d4834c9e93b485348236dd7fb953f9ef500bd1 (patch) | |
tree | ae9690d7072b5bb3ff5043a70b2b6eacf9c32063 | |
parent | ff24d06d2dcac49a6145a54d4dbaadb26e1a1049 (diff) | |
download | SCons-a4d4834c9e93b485348236dd7fb953f9ef500bd1.zip SCons-a4d4834c9e93b485348236dd7fb953f9ef500bd1.tar.gz SCons-a4d4834c9e93b485348236dd7fb953f9ef500bd1.tar.bz2 |
Simplify more tests to use unittest.main
For issue #3113, but does not complete it - there are still uses of
TestSuite where the "simple fix" from the issue requires more thought.
Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r-- | SCons/BuilderTests.py | 11 | ||||
-rw-r--r-- | SCons/EnvironmentTests.py | 21 | ||||
-rw-r--r-- | SCons/PathListTests.py | 11 | ||||
-rw-r--r-- | SCons/SConsignTests.py | 13 | ||||
-rw-r--r-- | SCons/Scanner/RCTests.py | 7 |
5 files changed, 9 insertions, 54 deletions
diff --git a/SCons/BuilderTests.py b/SCons/BuilderTests.py index 6dfefd5..d8c9d48 100644 --- a/SCons/BuilderTests.py +++ b/SCons/BuilderTests.py @@ -1617,16 +1617,7 @@ class CompositeBuilderTestCase(unittest.TestCase): assert str(err) == expect, err if __name__ == "__main__": - suite = unittest.TestSuite() - tclasses = [ - BuilderTestCase, - CompositeBuilderTestCase - ] - for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(list(map(tclass, names))) - - TestUnit.run(suite) + unittest.main() # Local Variables: # tab-width:4 diff --git a/SCons/EnvironmentTests.py b/SCons/EnvironmentTests.py index b8f18d5..7a26a61 100644 --- a/SCons/EnvironmentTests.py +++ b/SCons/EnvironmentTests.py @@ -1376,7 +1376,7 @@ def generate(env, **kw): env[k] = v def exists(env): - return 1 + return True """) env = self.TestEnvironment(tools = [('faketool', {'a':1, 'b':2, 'c':3})], @@ -1856,14 +1856,14 @@ def exists(env): test.write('xxx.py', """\ def exists(env): - 1 + return True def generate(env): env['XXX'] = 'one' """) test.write('yyy.py', """\ def exists(env): - 1 + return True def generate(env): env['YYY'] = 'two' """) @@ -2481,14 +2481,14 @@ f5: \ test.write('xxx.py', """\ def exists(env): - 1 + return True def generate(env): env['XXX'] = 'one' """) test.write('yyy.py', """\ def exists(env): - 1 + return True def generate(env): env['YYY'] = 'two' """) @@ -3951,16 +3951,7 @@ class EnvironmentVariableTestCase(unittest.TestCase): if __name__ == "__main__": - suite = unittest.TestSuite() - tclasses = [ SubstitutionTestCase, - BaseTestCase, - OverrideEnvironmentTestCase, - NoSubstitutionProxyTestCase, - EnvironmentVariableTestCase ] - for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(list(map(tclass, names))) - TestUnit.run(suite) + unittest.main() # Local Variables: # tab-width:4 diff --git a/SCons/PathListTests.py b/SCons/PathListTests.py index 0d15c08..80f2b9c 100644 --- a/SCons/PathListTests.py +++ b/SCons/PathListTests.py @@ -189,16 +189,7 @@ class PathListTestCase(unittest.TestCase): if __name__ == "__main__": - suite = unittest.TestSuite() - tclasses = [ - subst_pathTestCase, - PathListCacheTestCase, - PathListTestCase, - ] - for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(list(map(tclass, names))) - TestUnit.run(suite) + unittest.main() # Local Variables: # tab-width:4 diff --git a/SCons/SConsignTests.py b/SCons/SConsignTests.py index 2f832b4..84c1d41 100644 --- a/SCons/SConsignTests.py +++ b/SCons/SConsignTests.py @@ -382,18 +382,7 @@ class writeTestCase(SConsignTestCase): if __name__ == "__main__": - suite = unittest.TestSuite() - tclasses = [ - BaseTestCase, - SConsignDBTestCase, - SConsignDirFileTestCase, - SConsignFileTestCase, - writeTestCase, - ] - for tclass in tclasses: - names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(list(map(tclass, names))) - TestUnit.run(suite) + unittest.main() # Local Variables: # tab-width:4 diff --git a/SCons/Scanner/RCTests.py b/SCons/Scanner/RCTests.py index 347149c..487250e 100644 --- a/SCons/Scanner/RCTests.py +++ b/SCons/Scanner/RCTests.py @@ -158,13 +158,6 @@ class RCScannerTestCase3(unittest.TestCase): deps_match(self, deps, headers) -def suite(): - suite = unittest.TestSuite() - suite.addTest(RCScannerTestCase1()) - suite.addTest(RCScannerTestCase2()) - suite.addTest(RCScannerTestCase3()) - return suite - if __name__ == "__main__": unittest.main() |