New submission from James Corbett <james.h.corb...@gmail.com>:
The `unittest.TestCase.skipTest` method, used to skip the current test, is currently an instance method. There's nothing to stop it from being a `classmethod` or a `staticmethod` though---it doesn't use its reference to `self` since it's just a wrapper around the `SkipTest` exception. Making it a `classmethod` or `staticmethod` would allow calling the method from `setUpClass`. Here's an example: ``` import unittest class MyTestCase(unittest.TestCase): @classmethod def ready_for_tests(cls): pass @classmethod def setUpClass(cls): if not cls.ready_for_tests(): cls.skipTest() ``` ---------- components: Library (Lib) messages: 371914 nosy: jameshcorbett priority: normal severity: normal status: open title: unittest: make skipTest a classmethod type: enhancement versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41046> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com