-
Notifications
You must be signed in to change notification settings - Fork 252
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-decorated
option enabled)error: Untyped decorator makes function {function-name} untyped [misc]
on any function decorated with @allure.step(...) and similars (occurs when enableddisallow-untyped-decorators
option 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-unimported
option 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:
return
And 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: pytest@7.2.0
- Allure adaptor: allure-pytest@2.10.0
Other information
Many of theese problems just solves itself if there will py.typed
file in modules, as described in PEP-561.