| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There are two non-optimal things in the current way scope checking is done: - It runs on `SubRequest`, but doesn't use the `SubRequest's scope, which is confusing. Instead it takes `invoking_scope` and `requested_scope`. - Because `_check_scope` is only defined on `SubRequest` and not `TopRequest`, `_compute_fixture_value` first creates the `SubRequest` only then checks the scope (hence the need for the previous point). Instead, also define `_check_scope` on `TopRequest` (always valid), and remove `invoking_scope`, using `self._scope` instead.
- Separate the requesting from the requested. - Avoid the term "factory", I think most people don't distinguish between "fixture" and "fixture function" (i.e. "factory") and would find the term "factory" unfamiliar.
This makes sure the scope is always compatible, and also allows using `getfixturevalue` in `pytest_fixture_setup` so less internal magic.
There was a problem hiding this comment.
Looks great, nice cleanup!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
These are a few more cleanup commits to the fixtures code, in the continuing quest to bring out its inner beauty :)