summaryrefslogtreecommitdiff
path: root/docutils/test
diff options
context:
space:
mode:
authoraa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-10-28 02:07:34 +0000
committeraa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-10-28 02:07:34 +0000
commite9720985ed66e460e07798bf70bf16c19e5ddd5b (patch)
tree9a21a77edc9b520d3ba933670c8963f5b72f39ed /docutils/test
parent5e3519dafe378e5a57ad612d146b5a371f4a06bf (diff)
downloaddocutils-e9720985ed66e460e07798bf70bf16c19e5ddd5b.tar.gz
Report sub-tests individually in the test summary
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9188 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test')
-rwxr-xr-xdocutils/test/alltests.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/docutils/test/alltests.py b/docutils/test/alltests.py
index 1c26646f0..baae49d66 100755
--- a/docutils/test/alltests.py
+++ b/docutils/test/alltests.py
@@ -116,6 +116,16 @@ def path2mod(path):
return path[:-3].replace(os.sep, '.')
+class NumbersTestResult(unittest.TextTestResult):
+ """Result class that counts subTests."""
+ def addSubTest(self, test, subtest, error):
+ super().addSubTest(test, subtest, error)
+ self.testsRun += 1
+ if self.dots:
+ self.stream.write('.' if error is None else 'E')
+ self.stream.flush()
+
+
if __name__ == '__main__':
suite = loadTestModules(DocutilsTestSupport.testroot)
print(f'Testing Docutils {docutils.__version__} '
@@ -126,7 +136,7 @@ if __name__ == '__main__':
print(f'Working directory: {os.getcwd()}')
print(f'Docutils package: {os.path.dirname(docutils.__file__)}')
sys.stdout.flush()
- result = unittest.TextTestRunner().run(suite)
+ result = unittest.TextTestRunner(resultclass=NumbersTestResult).run(suite)
finish = time.time()
print(f'Elapsed time: {finish - start:.3f} seconds')
sys.exit(not result.wasSuccessful())