This rule raises an issue when a method in a test class is not discoverable as a test and is never used within its test class.
As classes subclassing unittest.TestCase or unittest.IsolatedAsyncioTestCase will be executed as tests, they should
define test methods and not be used as "abstract" parent helper. Methods within the class will be discovered by the test runner if their name starts
with test. If a method intended to be a test does not respect this convention, it will not be executed.
For a class to be considered a test case, it should subclass only unittest.TestCase or unittest.IsolatedAsyncioTestCase.
If it subclasses other classes, it might be a mixin. This rule raises an issue when a method is not discoverable as a test and is never used within
its test case class.
This rule will not raise if:
tearDown or asyncSetUp method). import unittest class MyTest(unittest.TestCase): def setUp(self): ... # OK (unittest.TestCase method) def something_test(self): ... # Noncompliant
import unittest class MyTest(unittest.TestCase): def setUp(self): ... def test_something(self): ...