From 91acfc3514280370535f1dd6bebee57760bac7b9 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Thu, 4 Nov 2021 15:31:26 +0100 Subject: Fixed #33264 -- Made test runner return non-zero error code for unexpected successes. --- tests/test_runner_apps/failures/__init__.py | 0 tests/test_runner_apps/failures/tests_failures.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/test_runner_apps/failures/__init__.py create mode 100644 tests/test_runner_apps/failures/tests_failures.py (limited to 'tests/test_runner_apps') diff --git a/tests/test_runner_apps/failures/__init__.py b/tests/test_runner_apps/failures/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/test_runner_apps/failures/tests_failures.py b/tests/test_runner_apps/failures/tests_failures.py new file mode 100644 index 0000000000..0483fcd0f1 --- /dev/null +++ b/tests/test_runner_apps/failures/tests_failures.py @@ -0,0 +1,23 @@ +from unittest import TestCase, expectedFailure + + +class FailureTestCase(TestCase): + def test_sample(self): + self.assertEqual(0, 1) + + +class ErrorTestCase(TestCase): + def test_sample(self): + raise Exception('test') + + +class ExpectedFailureTestCase(TestCase): + @expectedFailure + def test_sample(self): + self.assertEqual(0, 1) + + +class UnexpectedSuccessTestCase(TestCase): + @expectedFailure + def test_sample(self): + self.assertEqual(1, 1) -- cgit v1.3