bpo-34279: regrtest consider that skipped tests are ran (GH-11132) · python/cpython@3a8f4fe · GitHub
Skip to content

Commit 3a8f4fe

Browse files
authored
bpo-34279: regrtest consider that skipped tests are ran (GH-11132)
bpo-34279, bpo-35412: support.run_unittest() no longer raises TestDidNotRun if a test result contains skipped tests. The exception is now only raised if no test have been run and no test have been skipped.
1 parent 7acd50a commit 3a8f4fe

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

Lib/test/support/__init__.py

Lines changed: 1 addition & 1 deletion

Lib/test/test_regrtest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ def test_bug(self):
10041004
output = self.run_tests("-w", testname, exitcode=2)
10051005
self.check_executed_tests(output, [testname],
10061006
failed=testname, rerun=testname)
1007+
10071008
def test_no_tests_ran(self):
10081009
code = textwrap.dedent("""
10091010
import unittest
@@ -1017,6 +1018,19 @@ def test_bug(self):
10171018
output = self.run_tests(testname, "-m", "nosuchtest", exitcode=0)
10181019
self.check_executed_tests(output, [testname], no_test_ran=testname)
10191020

1021+
def test_no_tests_ran_skip(self):
1022+
code = textwrap.dedent("""
1023+
import unittest
1024+
1025+
class Tests(unittest.TestCase):
1026+
def test_skipped(self):
1027+
self.skipTest("because")
1028+
""")
1029+
testname = self.create_test(code=code)
1030+
1031+
output = self.run_tests(testname, exitcode=0)
1032+
self.check_executed_tests(output, [testname])
1033+
10201034
def test_no_tests_ran_multiple_tests_nonexistent(self):
10211035
code = textwrap.dedent("""
10221036
import unittest
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)