Skip to content

Instantly share code, notes, and snippets.

@Paebbels
Created December 28, 2020 11:05
Show Gist options
  • Save Paebbels/4a89ef86fbfa14188e22bc8b3c226034 to your computer and use it in GitHub Desktop.
Save Paebbels/4a89ef86fbfa14188e22bc8b3c226034 to your computer and use it in GitHub Desktop.
Abort following tests if one failed.
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