Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ def _run_suite(suite):
runner = BasicTestRunner()

result = runner.run(suite)
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:
Expand Down
13 changes: 13 additions & 0 deletions Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,19 @@ def test_main():
output = self.run_tests("-m", "nosuchtest", testname, 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:func:`test.support.run_unittest` no longer raise :exc:`TestDidNotRun` if
the test result contains skipped tests. The exception is now only raised if
no test have been run and no test have been skipped.