There are several issues with using pyright as lsp:
When using allure.step as a context manager with with 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.step as 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.
Context
There are several issues with using pyright as lsp:
allure.step
as 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)
.allure.step
as 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__"
.Checklist