diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-01-09 21:34:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 21:34:38 (GMT) |
commit | 159e3db1f7697b9aecdf674bb833fbb87f3dcad3 (patch) | |
tree | a327c8e369182098f55e329d2233133d85258f87 /Lib/test | |
parent | 85cf360d2994514e2eae6f851750cff5d3d32235 (diff) | |
download | cpython-159e3db1f7697b9aecdf674bb833fbb87f3dcad3.zip cpython-159e3db1f7697b9aecdf674bb833fbb87f3dcad3.tar.gz cpython-159e3db1f7697b9aecdf674bb833fbb87f3dcad3.tar.bz2 |
[3.12] GH-113661: unittest runner: Don't exit 5 if tests were skipped (GH-113856) (#113875)
GH-113661: unittest runner: Don't exit 5 if tests were skipped (GH-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.
(cherry picked from commit 3a9096c337c16c9335e0d4eba8d1d4196258af72)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
Diffstat (limited to 'Lib/test')
-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: |