From c249066dbfdeebc35ba413f7a05b86281cf7a1a7 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 15 Mar 2007 18:11:05 +0000 Subject: [PATCH] "alltests" runners call testbase.main(), which takes an optional suite, so that exit code is propigated --- test/alltests.py | 2 +- test/base/alltests.py | 2 +- test/engine/alltests.py | 2 +- test/ext/alltests.py | 2 +- test/orm/alltests.py | 2 +- test/sql/alltests.py | 2 +- test/testbase.py | 11 ++++++----- test/zblog/alltests.py | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/test/alltests.py b/test/alltests.py index c60e73641d..3fbace0160 100644 --- a/test/alltests.py +++ b/test/alltests.py @@ -16,4 +16,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/base/alltests.py b/test/base/alltests.py index 887e4567cc..70ff83ab8a 100644 --- a/test/base/alltests.py +++ b/test/base/alltests.py @@ -16,4 +16,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/engine/alltests.py b/test/engine/alltests.py index 7bb9acb72f..8110396b31 100644 --- a/test/engine/alltests.py +++ b/test/engine/alltests.py @@ -26,4 +26,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/ext/alltests.py b/test/ext/alltests.py index e13f5472f9..a056776dc3 100644 --- a/test/ext/alltests.py +++ b/test/ext/alltests.py @@ -17,4 +17,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/orm/alltests.py b/test/orm/alltests.py index c30bc14064..46eeb3ce92 100644 --- a/test/orm/alltests.py +++ b/test/orm/alltests.py @@ -46,4 +46,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/sql/alltests.py b/test/sql/alltests.py index 98dbfa6a07..2517cdf8d2 100644 --- a/test/sql/alltests.py +++ b/test/sql/alltests.py @@ -31,4 +31,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) diff --git a/test/testbase.py b/test/testbase.py index 47ddaec8bc..34c05b8e50 100644 --- a/test/testbase.py +++ b/test/testbase.py @@ -407,12 +407,13 @@ def cover(callable_): coverage_client.save() coverage_client.report(list(covered_files()), show_missing=False, ignore_errors=False) -def main(): +def main(suite=None): - if len(sys.argv[1:]): - suite =unittest.TestLoader().loadTestsFromNames(sys.argv[1:], __import__('__main__')) - else: - suite = unittest.TestLoader().loadTestsFromModule(__import__('__main__')) + if not suite: + if len(sys.argv[1:]): + suite =unittest.TestLoader().loadTestsFromNames(sys.argv[1:], __import__('__main__')) + else: + suite = unittest.TestLoader().loadTestsFromModule(__import__('__main__')) result = runTests(suite) sys.exit(not result.wasSuccessful()) diff --git a/test/zblog/alltests.py b/test/zblog/alltests.py index 9368eb8207..ed430ac7ee 100644 --- a/test/zblog/alltests.py +++ b/test/zblog/alltests.py @@ -15,4 +15,4 @@ def suite(): if __name__ == '__main__': - testbase.runTests(suite()) + testbase.main(suite()) -- 2.47.2