[BUG] PyLint invalid-name: False negatives on nested subclasses of `unittest.TestCase`
Describe the bug
If ./src/foo/tests/__init__.py defines a class that extends unittest.TestCase and overrides the unittest.TestCase.setUp method, Prospector doesn't report an error:
class FooTestCase(unittest.TestCase):
def setUp(self):
super().setUp()
If that class is used as a project-specific base test case class to be used in the actual test modules, however, then Prospector reports pylint: invalid-name / Method name "setUp" doesn't conform to snake_case naming style (col 4) if that class overrides the setUp() method. For example, ./src/foo/tests/test_bar.py:
from .. import tests
class BarTests(tests.FooTestCase):
def setUp(self):
super().setUp()
Running $ pylint ./src/foo directly doesn't report any error in either case so it seems this is specific to prospector.
To Reproduce Steps to reproduce the behavior:
$ prospector ./src/foo
Expected behavior
Prospector should report no errors the same as running PyLint directly does.
Environment:
- OS: Docker
python:3.11image - Tool: pylint
- Prospector version: v1.9.0
- Python version: v3.11.2
Additional context
I confirmed that if I switch the test class to subclass unittest.TestCase directly then Prospector does not report the error:
class BarTests(unittest.TestCase):
Not sure if it's relevant, but I found this PyLint issue if it helps.