Trying to use pylint on a file called 'pytest' gives errors, originating from the file astroid/brain/brain_pytest.py, even if the actual file-under-test is empty.
Renaming the file-under-test from pytest to e.g. foobar removes the errors.
Without knowing more about internals, my view is that:
It is not correct that a hook for 'pytest' is included just because the module-to-be-linted is called pytest. There may or may not be a relation. In this case, the local pytest is intended to be a wrapper around calling pytest, but is not actually importing pytest (it will call it via subprocess).
Even if it is warranted that real pytest imports are done via astroid, the user should not be presented with pylint errors from that module, because they only asked to lint the local module-under-test.
Bug description
Trying to use pylint on a file called 'pytest' gives errors, originating from the file astroid/brain/brain_pytest.py, even if the actual file-under-test is empty. Renaming the file-under-test from
pytest
to e.g.foobar
removes the errors.Configuration
No response
Command used
Pylint output
Expected behavior
Without knowing more about internals, my view is that:
Pylint version
OS / Environment
Gentoo Linux
Additional dependencies
No response