Skip to content
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

fixtures: change FixtureDef.cached_result[2] from exception triplet to exception #11208

Closed
bluetech opened this issue Jul 14, 2023 · 2 comments
Closed
Labels
topic: fixtures anything involving fixtures directly or indirectly type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature

Comments

@bluetech
Copy link
Member

I propose changing the type of the 3rd item of FixtureDef.cached_result (which indicates a cached exception outcome of the fixture) from a sys.exc_info style triplet to just the exception instance.

The sys.exc_info exception triplet format is legacy from Python 2 and just complicates things nowadays.

While cached_result is not documented and is a private API, from 680 plugins I have checked out locally, 15 access it. However, none of them care about the type of cached_result[2], except for pytest-yield plugin, but it's already broken in recent pytests and only supports pytest<=4.

@bluetech bluetech added type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature topic: fixtures anything involving fixtures directly or indirectly labels Jul 14, 2023
bluetech added a commit to bluetech/pytest that referenced this issue Jul 14, 2023
@RonnyPfannschmidt
Copy link
Member

+1 from me, but id also like to ensure we move the cache to the setup state in future

@bluetech
Copy link
Member Author

+1 from me, but id also like to ensure we move the cache to the setup state in future

I think something like that will be necessary for fixing #11205. There our preferred approach has a single FixtureDef having multiple values at the same time (for different nested scopes), so a single cached_result on the FixtureDef can no longer work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: fixtures anything involving fixtures directly or indirectly type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

2 participants