allure-python
allure-python copied to clipboard
Add typehints for step func returning types
Context
There are several issues with using pyright as lsp:
- When using
allure.stepas a context manager withwith allure.step, pyright returned the errors:Object of type "(...) -> object" cannot be used with "with" because it does not implement __exit__,Object of type "(...) -> object" cannot be used with "with" because it does not implement __enter__ (lsp). - When using
allure.stepas a decorator along with@property, pyright returned the error:Argument of type "((self: Self@ClassName) -> SomeReturnType) | object" cannot be assigned to parameter "fget" of type "((Any) -> Any) | None" in function "__init__". - The most critical part: because pyright could not correctly determine the types, there was no autocompletion available when writing tests using pyright as the LSP.
Checklist
- [x] Sign Allure CLA
- [ ] Provide unit tests / no unittests needed