Skip to content

Conversation

@daria-shaw
Copy link
Contributor

This will raise a warning in an upcoming change in pytest.

This will raise a warning in an upcoming change in pytest
@jsa34
Copy link
Collaborator

jsa34 commented Nov 30, 2024

I think we need to either introduce a sort of "ScenarioFunction" protocol for mypy to be happy and expect scenario, or some short term ignoring of the mypy error, unless I am missing something, @youtux ?

@The-Compiler
Copy link
Member

The-Compiler commented Nov 30, 2024

It's not quite clear to me how this change leads to mypy suddenly seeing the type of scenario_wrapper. It was Any before, and now mypy correctly sees that it's actually Callable[[FixtureRequest, dict[str, str]], Any] aka

def (request: _pytest.fixtures.FixtureRequest, _pytest_bdd_example: builtins.dict[builtins.str, builtins.str]) -> Any

Given the decorator is typed, this should already have been the case before I believe?

As this isn't really related to this PR and we do a return cast(Callable[P, T], scenario_wrapper) at the end already anyways, in the scope of this PR it seems reasonable to me to ignore the error.

youtux
youtux previously approved these changes Nov 30, 2024
@youtux youtux enabled auto-merge November 30, 2024 12:55
@codecov
Copy link

codecov bot commented Nov 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.95%. Comparing base (93e446e) to head (a4bf843).
Report is 126 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #746   +/-   ##
=======================================
  Coverage   95.95%   95.95%           
=======================================
  Files          55       55           
  Lines        2199     2200    +1     
  Branches      242      242           
=======================================
+ Hits         2110     2111    +1     
  Misses         54       54           
  Partials       35       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@youtux youtux merged commit 766fabe into pytest-dev:master Nov 30, 2024
11 checks passed
@daria-shaw daria-shaw deleted the fix-empty-usefixtures branch November 30, 2024 13:17
@youtux
Copy link
Contributor

youtux commented Nov 30, 2024

I think we need to either introduce a sort of "ScenarioFunction" protocol for mypy to be happy and expect scenario, or some short term ignoring of the mypy error, unless I am missing something, @youtux ?

Actually I wanted to fix that in a different way. I started the work in #658, but never got to finish it...

@jsa34
Copy link
Collaborator

jsa34 commented Nov 30, 2024

I think we need to either introduce a sort of "ScenarioFunction" protocol for mypy to be happy and expect scenario, or some short term ignoring of the mypy error, unless I am missing something, @youtux ?

Actually I wanted to fix that in a different way. I started the work in #658, but never got to finish it...

Ah, yes! I remember this now!

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