diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2018-11-29 17:17:44 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-11-29 17:17:44 (GMT) |
commit | 9724348b43a9005a449ba532ccd3c6726f031097 (patch) | |
tree | 1620bf60b6a756571d9647bf2c536e4554e2fbca /Lib/test/support | |
parent | b2774c8e91d2f55304ead0b26e9476571ec1e95b (diff) | |
download | cpython-9724348b43a9005a449ba532ccd3c6726f031097.zip cpython-9724348b43a9005a449ba532ccd3c6726f031097.tar.gz cpython-9724348b43a9005a449ba532ccd3c6726f031097.tar.bz2 |
bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10150)
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f7a60d4..f90212c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -72,7 +72,7 @@ __all__ = [ # globals "PIPE_MAX_SIZE", "verbose", "max_memuse", "use_resources", "failfast", # exceptions - "Error", "TestFailed", "ResourceDenied", + "Error", "TestFailed", "TestDidNotRun", "ResourceDenied", # imports "import_module", "import_fresh_module", "CleanImport", # modules @@ -120,6 +120,9 @@ class Error(Exception): class TestFailed(Error): """Test failed.""" +class TestDidNotRun(Error): + """Test did not run any subtests.""" + class ResourceDenied(unittest.SkipTest): """Test skipped because it requested a disallowed resource. @@ -1930,6 +1933,8 @@ def _run_suite(suite): if junit_xml_list is not None: junit_xml_list.append(result.get_xml_element()) + if not result.testsRun: + raise TestDidNotRun if not result.wasSuccessful(): if len(result.errors) == 1 and not result.failures: err = result.errors[0][1] |