FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add type hint to allure.step parameters (fixes #828) by darsor · Pull Request #838 · allure-framework/allure-python · GitHub

Add type hint to allure.step parameters (fixes #828) - #838

Closed
darsor wants to merge 1 commit into
allure-framework:masterfrom
darsor:allure-step-type-hint
Closed

Add type hint to allure.step parameters (fixes #828)#838
darsor wants to merge 1 commit into
allure-framework:masterfrom
darsor:allure-step-type-hint

Conversation

darsor commented Feb 7, 2025

Copy link
Copy Markdown

Context

Current versions of Pyright flag errors on functions decorated with @allure.step, as reported in #828. Adding type hints to allure.step fixes this issue.

Tests pass on Python 3.7 and Python 3.13.

Checklist

CLAassistant commented Feb 7, 2025
edited
Loading

Copy link
Copy Markdown


All committers have signed the CLA.

kamikaze commented Mar 3, 2025

Copy link
Copy Markdown

it seems something is wrong withing CI build pipeline, not the PR. could please someone take a look? this PR might help a lot of people :)

baev force-pushed the allure-step-type-hint branch from f0be248 to 07c7b40 Compare March 26, 2025 13:06

delatrie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hi, @darsor ! Thank you for contributing in allure-python!

Let's better use @typing.overload:

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

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

This will require moving StepContext above step.

And it also makes sense to disable type checking when returning the wrapper in StepContext.__call__ for those of us who enable pyright when working on the repo :)

return impl # type: ignore

Copy link
Copy Markdown
Contributor

Turns out #830 implements this in a more correct way.
I'm closing this PR as a duplicate then.

delatrie closed this Mar 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL