allure-framework / allure-python

Allure integrations for Python test frameworks
https://allurereport.org/
Apache License 2.0
730 stars 238 forks source link

Need to add overload functions for allure.step() #759

Open anci3ntr0ck opened 1 year ago

anci3ntr0ck commented 1 year ago

I'm submitting a ...

What is the current behavior?

VSCode gives an error when using allure.step() as a context: image

Adding overload functions for allure.step() should fix this...

_TFunc = TypeVar("_TFunc", bound=Callable[..., Any])

@overload
def step(title: _TFunc) -> _TFunc: ...
@overload
def step(title: Any) -> StepContext: ...

Please tell us about your environment:

rafaelcs commented 1 year ago

Same here! I'm getting this Pylance warning:

Object of type "(...) -> Any" cannot be used with "with" because it does not implement __enter__Pylance(reportGeneralTypeIssues)
dc-avasilev commented 1 year ago

+1

DJSdev commented 1 month ago

As a temporary work around, I ended up rolling Pylance back to the previous version. I went from 2024.10.1 to 2024.9.2