Last active
December 5, 2022 16:18
-
-
Save jonashaag/834a5f6051094dbed3bc to your computer and use it in GitHub Desktop.
Python unittest base class skipper
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
| def test_base(base_cls): | |
| class BaseClassSkipper(base_cls): | |
| @classmethod | |
| def setUpClass(cls): | |
| if cls is BaseClassSkipper: | |
| raise unittest.SkipTest("Base class") | |
| super().setUpClass() | |
| return BaseClassSkipper |
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
| @test_base | |
| class TestsBase(TestCase): | |
| ... | |
| class ConcreteTest(TestsBase): | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only thing that worked for me is
in test_base.py