Unexepected "No name 'absltest' ..." lint error from pylint
greed42 opened this issue · comments
Graham Reed commented
When linting an absltest
-based test suite with pylint
, I am now getting the following message:
************* Module lint_bug
lint_bug.py:8:0: E0611: No name 'absltest' in module 'absl.testing' (no-name-in-module)
This has only started as of absl-py==0.9.0
, and requires the type declaration for TestCase.enter_context
, # type: (ContextManager[_T]) -> _T
, be present in absltest.py
.
It looks a bit like this is actually a fault with pylint
, but have not been able to create a standalone reproduction case at this point. The code -- both the reduced fragment below and my original test suite -- run correctly. (And pytest is happy with them as well.)
The source for lint_bug.py
is:
"""Show an unexpected pylint error with absltest.
There is an unexpected no-name-in-module with absl-py==0.9.0.
pip3 install pylint==2.4.4 absl-py==0.9.0
python3 -m pylint lint_bug.py
"""
from absl.testing import absltest
if __name__ == '__main__':
absltest.main()
Cor-leone commented