summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support/__init__.py2
-rw-r--r--Lib/test/test_regrtest.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 05e8593..9b6c338 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1937,7 +1937,7 @@ def _run_suite(suite):
if junit_xml_list is not None:
junit_xml_list.append(result.get_xml_element())
- if not result.testsRun:
+ if not result.testsRun and not result.skipped:
raise TestDidNotRun
if not result.wasSuccessful():
if len(result.errors) == 1 and not result.failures:
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index db9bd6d..a674583 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1004,6 +1004,7 @@ class ArgsTestCase(BaseTestCase):
output = self.run_tests("-w", testname, exitcode=2)
self.check_executed_tests(output, [testname],
failed=testname, rerun=testname)
+
def test_no_tests_ran(self):
code = textwrap.dedent("""
import unittest
@@ -1017,6 +1018,19 @@ class ArgsTestCase(BaseTestCase):
output = self.run_tests(testname, "-m", "nosuchtest", exitcode=0)
self.check_executed_tests(output, [testname], no_test_ran=testname)
+ def test_no_tests_ran_skip(self):
+ code = textwrap.dedent("""
+ import unittest
+
+ class Tests(unittest.TestCase):
+ def test_skipped(self):
+ self.skipTest("because")
+ """)
+ testname = self.create_test(code=code)
+
+ output = self.run_tests(testname, exitcode=0)
+ self.check_executed_tests(output, [testname])
+
def test_no_tests_ran_multiple_tests_nonexistent(self):
code = textwrap.dedent("""
import unittest