diff options
author | Stefano Rivera <stefano@rivera.za.net> | 2024-01-09 19:50:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 19:50:01 (GMT) |
commit | 3a9096c337c16c9335e0d4eba8d1d4196258af72 (patch) | |
tree | b8c47dbf94a29a8ca02dc5219197b196918be441 /Lib/test/test_unittest/test_program.py | |
parent | 0297418cacf998e778bc0517aa11eaac827b8c0f (diff) | |
download | cpython-3a9096c337c16c9335e0d4eba8d1d4196258af72.zip cpython-3a9096c337c16c9335e0d4eba8d1d4196258af72.tar.gz cpython-3a9096c337c16c9335e0d4eba8d1d4196258af72.tar.bz2 |
GH-113661: unittest runner: Don't exit 5 if tests were skipped (#113856)
The intention of exiting 5 was to detect issues where the test suite
wasn't discovered at all. If we skipped tests, it was correctly
discovered.
Diffstat (limited to 'Lib/test/test_unittest/test_program.py')
-rw-r--r-- | Lib/test/test_unittest/test_program.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_unittest/test_program.py b/Lib/test/test_unittest/test_program.py index f6d52f9..d8f5d36 100644 --- a/Lib/test/test_unittest/test_program.py +++ b/Lib/test/test_unittest/test_program.py @@ -167,6 +167,18 @@ class Test_TestProgram(unittest.TestCase): 'expected failures=1, unexpected successes=1)\n') self.assertTrue(out.endswith(expected)) + def test_ExitSkippedSuite(self): + stream = BufferedWriter() + with self.assertRaises(SystemExit) as cm: + unittest.main( + argv=["foobar", "-k", "testSkipped"], + testRunner=unittest.TextTestRunner(stream=stream), + testLoader=self.TestLoader(self.FooBar)) + self.assertEqual(cm.exception.code, 0) + out = stream.getvalue() + expected = '\n\nOK (skipped=1)\n' + self.assertTrue(out.endswith(expected)) + def test_ExitEmptySuite(self): stream = BufferedWriter() with self.assertRaises(SystemExit) as cm: |