-
Notifications
You must be signed in to change notification settings - Fork 257
Description
I'm submitting a ...
- bug report
- feature request
- support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
Mypy typechecker assumes that allure lib is untyped and shows various error messages.
Any method decorated with allure.step is NOT checked for typing violations (like incompatible arguments types, incompatible returning types, LSP violations in decorated methods). Theese checks just silently passes EVEN if there is something bad exists.
There is incomplete list of messages and places which theese occurs:
error: Skipping analyzing "allure": module is installed, but missing library stubs or py.typed marker [import]on import allureerror: Function is untyped after decorator transformation [misc]on any function decorated with @allure.step(...) and similars (occurs when enableddisallow-any-decoratedoption enabled)error: Untyped decorator makes function {function-name} untyped [misc]on any function decorated with @allure.step(...) and similars (occurs when enableddisallow-untyped-decoratorsoption enabled)error: Argument {n} to {function-or-methoв-name} becomes "Any" due to an unfollowed import [no-any-unimported]on any parameter typed with thing imported from allure (occurs when enableddisallow-any-unimportedoption enabled)
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Create file with following code:
import allure
@allure.step("Do nothing")
def noop() -> None:
returnAnd run mypy on it.
Optionaly you can enable additional options - --disallow-any-decorated, --disallow-any-unimported, --disallow-untyped-decorators
What is the expected behavior?
Since the allure sources is well-typed there is no mypy warnings in places where allure things used and allure decorators usege does not prevents detecting various violations in decorated functions.
What is the motivation / use case for changing the behavior?
Better type checking for tests.
Please tell us about your environment:
- Allure version: ...
- Test framework: [email protected]
- Allure adaptor: [email protected]
Other information
Many of theese problems just solves itself if there will py.typed file in modules, as described in PEP-561.