summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/BuilderTests.py5
-rw-r--r--src/engine/SCons/CacheDirTests.py4
-rw-r--r--src/engine/SCons/DefaultsTests.py4
-rw-r--r--src/engine/SCons/EnvironmentTests.py7
-rw-r--r--src/engine/SCons/ErrorsTests.py6
-rw-r--r--src/engine/SCons/ExecutorTests.py5
-rw-r--r--src/engine/SCons/JobTests.py8
-rw-r--r--src/engine/SCons/MemoizeTests.py5
-rw-r--r--src/engine/SCons/Node/AliasTests.py5
-rw-r--r--src/engine/SCons/Node/FSTests.py7
-rw-r--r--src/engine/SCons/Node/NodeTests.py5
-rw-r--r--src/engine/SCons/Node/PythonTests.py5
-rw-r--r--src/engine/SCons/PathListTests.py5
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py5
-rw-r--r--src/engine/SCons/SConfTests.py6
-rw-r--r--src/engine/SCons/SConsignTests.py7
-rw-r--r--src/engine/SCons/Scanner/CTests.py9
-rw-r--r--src/engine/SCons/Scanner/DirTests.py7
-rw-r--r--src/engine/SCons/Scanner/FortranTests.py6
-rw-r--r--src/engine/SCons/Scanner/IDLTests.py12
-rw-r--r--src/engine/SCons/Scanner/LaTeXTests.py7
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py7
-rw-r--r--src/engine/SCons/Scanner/RCTests.py12
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py7
-rw-r--r--src/engine/SCons/Script/MainTests.py6
-rw-r--r--src/engine/SCons/SubstTests.py5
-rw-r--r--src/engine/SCons/TaskmasterTests.py5
-rw-r--r--src/engine/SCons/Tool/JavaCommonTests.py6
-rw-r--r--src/engine/SCons/Tool/PharLapCommonTests.py5
-rw-r--r--src/engine/SCons/Tool/ToolTests.py5
-rw-r--r--src/engine/SCons/Tool/javacTests.py9
-rw-r--r--src/engine/SCons/Tool/msvsTests.py6
-rw-r--r--src/engine/SCons/Tool/wixTests.py5
-rw-r--r--src/engine/SCons/UtilTests.py4
-rw-r--r--src/engine/SCons/Variables/BoolVariableTests.py5
-rw-r--r--src/engine/SCons/Variables/EnumVariableTests.py5
-rw-r--r--src/engine/SCons/Variables/ListVariableTests.py5
-rw-r--r--src/engine/SCons/Variables/PackageVariableTests.py5
-rw-r--r--src/engine/SCons/Variables/PathVariableTests.py5
-rw-r--r--src/engine/SCons/Variables/VariablesTests.py5
-rw-r--r--src/engine/SCons/WarningsTests.py6
-rw-r--r--src/engine/SCons/cppTests.py5
42 files changed, 145 insertions, 108 deletions
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index 766b8fe16..70a7a3fed 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -40,6 +40,7 @@ import sys
import unittest
import TestCmd
+import TestUnit
import SCons.Action
import SCons.Builder
@@ -1632,8 +1633,8 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/CacheDirTests.py b/src/engine/SCons/CacheDirTests.py
index 21b435a81..7ac97efa6 100644
--- a/src/engine/SCons/CacheDirTests.py
+++ b/src/engine/SCons/CacheDirTests.py
@@ -29,6 +29,7 @@ import sys
import unittest
from TestCmd import TestCmd
+import TestUnit
import SCons.CacheDir
@@ -287,8 +288,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/DefaultsTests.py b/src/engine/SCons/DefaultsTests.py
index fd10c129f..8b9fb4ec6 100644
--- a/src/engine/SCons/DefaultsTests.py
+++ b/src/engine/SCons/DefaultsTests.py
@@ -32,6 +32,7 @@ import unittest
from collections import UserDict
import TestCmd
+import TestUnit
import SCons.Errors
@@ -82,8 +83,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 7fa8af4e2..523534289 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -29,10 +29,12 @@ import copy
import io
import os
import sys
-import TestCmd
import unittest
from collections import UserDict as UD, UserList as UL
+import TestCmd
+import TestUnit
+
from SCons.Environment import *
import SCons.Warnings
@@ -3999,8 +4001,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/ErrorsTests.py b/src/engine/SCons/ErrorsTests.py
index 9c8b925f7..d57faa508 100644
--- a/src/engine/SCons/ErrorsTests.py
+++ b/src/engine/SCons/ErrorsTests.py
@@ -25,6 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+
+import TestUnit
+
import SCons.Errors
@@ -99,8 +102,7 @@ class ErrorsTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(ErrorsTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py
index 626898403..9df0b2d16 100644
--- a/src/engine/SCons/ExecutorTests.py
+++ b/src/engine/SCons/ExecutorTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Executor
@@ -455,8 +457,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/JobTests.py b/src/engine/SCons/JobTests.py
index e92bdbece..42d256852 100644
--- a/src/engine/SCons/JobTests.py
+++ b/src/engine/SCons/JobTests.py
@@ -25,10 +25,14 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import unittest
import random
import math
-import SCons.Job
import sys
import time
+import TestUnit
+
+import SCons.Job
+
+
# a large number
num_sines = 10000
@@ -521,7 +525,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
+ runner = TestUnit.cli.get_runner()
result = runner.run(suite())
if (len(result.failures) == 0
and len(result.errors) == 1
diff --git a/src/engine/SCons/MemoizeTests.py b/src/engine/SCons/MemoizeTests.py
index 9876c27fa..3606d5762 100644
--- a/src/engine/SCons/MemoizeTests.py
+++ b/src/engine/SCons/MemoizeTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Memoize
@@ -180,8 +182,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Node/AliasTests.py b/src/engine/SCons/Node/AliasTests.py
index b0efea771..2d11bdf9b 100644
--- a/src/engine/SCons/Node/AliasTests.py
+++ b/src/engine/SCons/Node/AliasTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Node.Alias
@@ -120,8 +122,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index a60b8a4b7..c4dc2ceda 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -31,10 +31,12 @@ import os.path
import sys
import time
import unittest
-from TestCmd import TestCmd
import shutil
import stat
+from TestCmd import TestCmd
+import TestUnit
+
import SCons.Errors
import SCons.Node.FS
import SCons.Util
@@ -3755,8 +3757,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index 076ca65ad..da502b0fb 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -30,6 +30,8 @@ import re
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Node
import SCons.Util
@@ -1311,8 +1313,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Node/PythonTests.py b/src/engine/SCons/Node/PythonTests.py
index 8b08c5205..fcdfe77a8 100644
--- a/src/engine/SCons/Node/PythonTests.py
+++ b/src/engine/SCons/Node/PythonTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Node.Python
@@ -120,8 +122,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py
index e83fc50d3..b5989bb39 100644
--- a/src/engine/SCons/PathListTests.py
+++ b/src/engine/SCons/PathListTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.PathList
@@ -196,8 +198,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py
index 6841272db..515382a34 100644
--- a/src/engine/SCons/Platform/PlatformTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -29,6 +29,8 @@ import collections
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Platform
@@ -118,8 +120,7 @@ class PlatformTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(PlatformTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py
index 1cfb05b78..1c4b40109 100644
--- a/src/engine/SCons/SConfTests.py
+++ b/src/engine/SCons/SConfTests.py
@@ -33,6 +33,8 @@ from types import *
import unittest
import TestCmd
+import TestUnit
+
sys.stdout = io.StringIO()
@@ -752,9 +754,7 @@ int main() {
if __name__ == "__main__":
suite = unittest.makeSuite(SConfTestCase, 'test_')
- res = unittest.TextTestRunner().run(suite)
- if not res.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/SConsignTests.py b/src/engine/SCons/SConsignTests.py
index ec063c2c5..f71e53e20 100644
--- a/src/engine/SCons/SConsignTests.py
+++ b/src/engine/SCons/SConsignTests.py
@@ -25,9 +25,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
-import TestCmd
import unittest
+import TestCmd
+import TestUnit
+
import SCons.dblite
import SCons.SConsign
@@ -387,8 +389,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py
index 5523f1042..6418754c6 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -28,9 +28,11 @@ import SCons.compat
import collections
import os
import sys
-import TestCmd
import unittest
+import TestCmd
+import TestUnit
+
import SCons.Node.FS
import SCons.Warnings
@@ -457,10 +459,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/DirTests.py b/src/engine/SCons/Scanner/DirTests.py
index 968d5d325..970192155 100644
--- a/src/engine/SCons/Scanner/DirTests.py
+++ b/src/engine/SCons/Scanner/DirTests.py
@@ -28,6 +28,8 @@ import sys
import unittest
import TestCmd
+import TestUnit
+
import SCons.Node.FS
import SCons.Scanner.Dir
@@ -126,10 +128,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py
index 3388ffcfc..252da648b 100644
--- a/src/engine/SCons/Scanner/FortranTests.py
+++ b/src/engine/SCons/Scanner/FortranTests.py
@@ -33,6 +33,7 @@ import SCons.Node.FS
import SCons.Warnings
import TestCmd
+import TestUnit
original = os.getcwd()
@@ -531,10 +532,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/IDLTests.py b/src/engine/SCons/Scanner/IDLTests.py
index c69672262..675c70cd4 100644
--- a/src/engine/SCons/Scanner/IDLTests.py
+++ b/src/engine/SCons/Scanner/IDLTests.py
@@ -23,12 +23,15 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestCmd
-import SCons.Scanner.IDL
import unittest
import sys
import os
import os.path
+
+import TestCmd
+import TestUnit
+
+import SCons.Scanner.IDL
import SCons.Node.FS
import SCons.Warnings
@@ -441,10 +444,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py
index 8cea63fa9..49553cfdb 100644
--- a/src/engine/SCons/Scanner/LaTeXTests.py
+++ b/src/engine/SCons/Scanner/LaTeXTests.py
@@ -31,6 +31,8 @@ import sys
import unittest
import TestCmd
+import TestUnit
+
import SCons.Node.FS
import SCons.Scanner.LaTeX
@@ -150,10 +152,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py
index 411e0358d..144addb1d 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -28,6 +28,8 @@ import sys
import unittest
import TestCmd
+import TestUnit
+
import SCons.Node.FS
import SCons.Scanner.Prog
@@ -249,10 +251,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/RCTests.py b/src/engine/SCons/Scanner/RCTests.py
index 880288504..2864026fd 100644
--- a/src/engine/SCons/Scanner/RCTests.py
+++ b/src/engine/SCons/Scanner/RCTests.py
@@ -23,12 +23,15 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestCmd
-import SCons.Scanner.RC
import unittest
import sys
import collections
import os
+
+import TestCmd
+import TestUnit
+
+import SCons.Scanner.RC
import SCons.Node.FS
import SCons.Warnings
@@ -164,10 +167,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index ee2692228..249653463 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -28,6 +28,8 @@ import collections
import sys
import unittest
+import TestUnit
+
import SCons.Scanner
class DummyFS(object):
@@ -593,10 +595,7 @@ def suite():
return suite
if __name__ == "__main__":
- runner = unittest.TextTestRunner()
- result = runner.run(suite())
- if not result.wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite())
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Script/MainTests.py b/src/engine/SCons/Script/MainTests.py
index c44c4268e..fd6aaf414 100644
--- a/src/engine/SCons/Script/MainTests.py
+++ b/src/engine/SCons/Script/MainTests.py
@@ -24,6 +24,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import unittest
+
+import TestUnit
+
import SCons.Errors
import SCons.Script.Main
@@ -43,8 +46,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py
index ee9f3db50..6f2eb3fe0 100644
--- a/src/engine/SCons/SubstTests.py
+++ b/src/engine/SCons/SubstTests.py
@@ -31,6 +31,8 @@ import unittest
from collections import UserDict
+import TestUnit
+
import SCons.Errors
from SCons.Subst import *
@@ -1233,8 +1235,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index e87515831..1d8199246 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -30,6 +30,8 @@ import copy
import sys
import unittest
+import TestUnit
+
import SCons.Taskmaster
import SCons.Errors
@@ -1223,8 +1225,7 @@ Taskmaster: No candidate anymore.
if __name__ == "__main__":
suite = unittest.makeSuite(TaskmasterTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py
index 76944c151..902030d8f 100644
--- a/src/engine/SCons/Tool/JavaCommonTests.py
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
@@ -27,6 +27,9 @@ import os.path
import sys
import unittest
+import TestUnit
+
+import SCons.Scanner.IDL
import SCons.Tool.JavaCommon
@@ -570,8 +573,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/PharLapCommonTests.py b/src/engine/SCons/Tool/PharLapCommonTests.py
index d1e7f6021..e67d42680 100644
--- a/src/engine/SCons/Tool/PharLapCommonTests.py
+++ b/src/engine/SCons/Tool/PharLapCommonTests.py
@@ -28,6 +28,8 @@ import os.path
import os
import sys
+import TestUnit
+
import SCons.Errors
from SCons.Tool.PharLapCommon import *
@@ -58,8 +60,7 @@ class PharLapCommonTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(PharLapCommonTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py
index 9595680ab..3e6da5b6c 100644
--- a/src/engine/SCons/Tool/ToolTests.py
+++ b/src/engine/SCons/Tool/ToolTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Tool
@@ -76,8 +78,7 @@ class ToolTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(ToolTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/javacTests.py b/src/engine/SCons/Tool/javacTests.py
index 4631c8a18..c1832a8d9 100644
--- a/src/engine/SCons/Tool/javacTests.py
+++ b/src/engine/SCons/Tool/javacTests.py
@@ -24,6 +24,8 @@
import os
import unittest
+import TestUnit
+
import SCons.Tool.javac
class DummyNode(object):
@@ -98,5 +100,10 @@ class pathoptTestCase(unittest.TestCase):
'/foo',
'')
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(pathoptTestCase())
+ return suite
+
if __name__ == "__main__":
- unittest.main()
+ TestUnit.run(suite)
diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py
index 3a9cac7c1..558f9f0dd 100644
--- a/src/engine/SCons/Tool/msvsTests.py
+++ b/src/engine/SCons/Tool/msvsTests.py
@@ -25,10 +25,12 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
-import TestCmd
import unittest
import copy
+import TestCmd
+import TestUnit
+
from SCons.Tool.msvs import *
from SCons.Tool.MSCommon.vs import SupportedVSList
import SCons.Util
@@ -759,7 +761,7 @@ if __name__ == "__main__":
del os.environ[k]
suite = unittest.makeSuite(test_class, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
+ if not TestUnit.cli.get_runner().run(suite).wasSuccessful():
exit_val = 1
finally:
os.env = back_osenv
diff --git a/src/engine/SCons/Tool/wixTests.py b/src/engine/SCons/Tool/wixTests.py
index c815dd059..c683e98d1 100644
--- a/src/engine/SCons/Tool/wixTests.py
+++ b/src/engine/SCons/Tool/wixTests.py
@@ -33,6 +33,8 @@ from SCons.Tool.wix import *
from SCons.Environment import Environment
import TestCmd
+import TestUnit
+
# create fake candle and light, so the tool's exists() method will succeed
test = TestCmd.TestCmd(workdir = '')
@@ -52,8 +54,7 @@ class WixTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(WixTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index a1e675678..b0c15c5d5 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -32,6 +32,7 @@ import unittest
from collections import UserDict, UserList, UserString
import TestCmd
+import TestUnit
import SCons.Errors
@@ -789,8 +790,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/BoolVariableTests.py b/src/engine/SCons/Variables/BoolVariableTests.py
index 8ffb0795d..7110f6f87 100644
--- a/src/engine/SCons/Variables/BoolVariableTests.py
+++ b/src/engine/SCons/Variables/BoolVariableTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Variables
@@ -117,8 +119,7 @@ class BoolVariableTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(BoolVariableTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/EnumVariableTests.py b/src/engine/SCons/Variables/EnumVariableTests.py
index f4b600d73..931dfe2b8 100644
--- a/src/engine/SCons/Variables/EnumVariableTests.py
+++ b/src/engine/SCons/Variables/EnumVariableTests.py
@@ -26,6 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Variables
@@ -194,8 +196,7 @@ class EnumVariableTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(EnumVariableTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/ListVariableTests.py b/src/engine/SCons/Variables/ListVariableTests.py
index 4959f6913..adfd353f1 100644
--- a/src/engine/SCons/Variables/ListVariableTests.py
+++ b/src/engine/SCons/Variables/ListVariableTests.py
@@ -27,6 +27,8 @@ import copy
import sys
import unittest
+import TestUnit
+
import SCons.Errors
import SCons.Variables
@@ -124,8 +126,7 @@ class ListVariableTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(ListVariableTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/PackageVariableTests.py b/src/engine/SCons/Variables/PackageVariableTests.py
index 2a9334841..3aa411d34 100644
--- a/src/engine/SCons/Variables/PackageVariableTests.py
+++ b/src/engine/SCons/Variables/PackageVariableTests.py
@@ -30,6 +30,8 @@ import SCons.Errors
import SCons.Variables
import TestCmd
+import TestUnit
+
class PackageVariableTestCase(unittest.TestCase):
def test_PackageVariable(self):
@@ -114,8 +116,7 @@ class PackageVariableTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(PackageVariableTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/PathVariableTests.py b/src/engine/SCons/Variables/PathVariableTests.py
index 084154bdf..42667591b 100644
--- a/src/engine/SCons/Variables/PathVariableTests.py
+++ b/src/engine/SCons/Variables/PathVariableTests.py
@@ -31,6 +31,8 @@ import SCons.Errors
import SCons.Variables
import TestCmd
+import TestUnit
+
class PathVariableTestCase(unittest.TestCase):
def test_PathVariable(self):
@@ -227,8 +229,7 @@ class PathVariableTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(PathVariableTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py
index ad46bd6d9..d2110c125 100644
--- a/src/engine/SCons/Variables/VariablesTests.py
+++ b/src/engine/SCons/Variables/VariablesTests.py
@@ -25,7 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+
import TestSCons
+import TestUnit
import SCons.Variables
import SCons.Subst
@@ -655,8 +657,7 @@ if __name__ == "__main__":
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/WarningsTests.py b/src/engine/SCons/WarningsTests.py
index 583b12a24..7b8d00daa 100644
--- a/src/engine/SCons/WarningsTests.py
+++ b/src/engine/SCons/WarningsTests.py
@@ -25,6 +25,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import unittest
+
+import TestUnit
+
import SCons.Warnings
class TestOutput(object):
@@ -125,8 +128,7 @@ class WarningsTestCase(unittest.TestCase):
if __name__ == "__main__":
suite = unittest.makeSuite(WarningsTestCase, 'test_')
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py
index 2f2025be3..5a06beed1 100644
--- a/src/engine/SCons/cppTests.py
+++ b/src/engine/SCons/cppTests.py
@@ -27,6 +27,8 @@ import atexit
import sys
import unittest
+import TestUnit
+
import cpp
@@ -705,8 +707,7 @@ if __name__ == '__main__':
pass
names.sort()
suite.addTests(list(map(tclass, names)))
- if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ TestUnit.run(suite)
# Local Variables:
# tab-width:4