Skip to content

Refactored scope handling in pytest 7 #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
The-Compiler opened this issue Dec 21, 2021 · 1 comment · Fixed by #247
Closed

Refactored scope handling in pytest 7 #241

The-Compiler opened this issue Dec 21, 2021 · 1 comment · Fixed by #247

Comments

@The-Compiler
Copy link

Thanks to pytest-dev/pytest#9415, we found out that pytest-cases breaks with pytest 7.0.0rc1:

  File "/home/florian/tmp/pytest-bisect/python-pytest-cases/src/pytest_cases/__init__.py", line 8, in <module>
    from .fixture_core1_unions import fixture_union, NOT_USED, unpack_fixture, ignore_unused
  File "/home/florian/tmp/pytest-bisect/python-pytest-cases/src/pytest_cases/fixture_core1_unions.py", line 26, in <module>
    from .common_pytest import get_fixture_name, is_marked_parameter_value, get_marked_parameter_values, pytest_fixture, \
  File "/home/florian/tmp/pytest-bisect/python-pytest-cases/src/pytest_cases/common_pytest.py", line 527, in <module>
    from _pytest.python import scopes as pt_scopes, Metafunc  # noqa
ImportError: cannot import name 'scopes' from '_pytest.python' (/home/florian/proj/pytest/src/_pytest/python.py)

this is due to this change: pytest-dev/pytest#8913 - looks like scopes are now an enum in a new scope.py.

smarie pushed a commit that referenced this issue Jan 3, 2022
…and `callspec._arg2scopenum` are now `fixdef._scope` and `callspec._arg2scope` and contain a `Scope`. Sorting of fixture defs is now done according to the reversed order of Scope enum instances. Not yet tested with pytest-7.0.0rc1. (hopefully) Fixed #241
smarie added a commit that referenced this issue Jan 3, 2022
* Completed fix for #243: now also with cases having parameters or requiring fixtures. Made the test only valid in python 3.

* Fixed version flag in develop mode - there was a bug due to the folder refactoring.

* Added support for the new Scopes enum in pytest 7: `fixdef.scopenum` and `callspec._arg2scopenum` are now `fixdef._scope` and `callspec._arg2scope` and contain a `Scope`. Sorting of fixture defs is now done according to the reversed order of Scope enum instances. Not yet tested with pytest-7.0.0rc1. (hopefully) Fixed #241

* Changelog 3.6.7

Co-authored-by: Sylvain MARIE <[email protected]>
@smarie
Copy link
Owner

smarie commented Jan 3, 2022

Thanks @The-Compiler ! I have tried to fix it in a blind way (not being able to grab 7.0.0rc1 from pypi and being extremely lazy), based on the diff. Let me know if 3.6.7 does not fix the issue !

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 a pull request may close this issue.

2 participants