allure-framework / allure-python

Allure integrations for Python test frameworks
https://allurereport.org/
Apache License 2.0
719 stars 235 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 11 months ago

+1