Created
December 28, 2020 11:05
-
-
Save Paebbels/4a89ef86fbfa14188e22bc8b3c226034 to your computer and use it in GitHub Desktop.
Abort following tests if one failed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeTestcases(TestCase): | |
_continueTesting = True | |
def setUp(self) -> None: | |
"""Check for every test, if tests should continue.""" | |
if not self.__class__._continueTesting: | |
self.skipTest("No reason to go on.") | |
def fail(self, msg: Any = ...) -> NoReturn: | |
self.__class__._continueTesting = False | |
super().fail(msg) | |
def test_Init(self) -> None: | |
# ... | |
if condition: | |
self.fail("this is why") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment