Skip to content

Add an internal "register fixture" API and use it replace object patching for fixture injection - #11780

Merged
bluetech merged 2 commits into
pytest-dev:mainfrom
bluetech:register-fixture
Jan 8, 2024
Merged

bluetech merged 2 commits into
pytest-dev:mainfrom
bluetech:register-fixture

Conversation

@bluetech

@bluetech bluetech commented Jan 6, 2024

Copy link
Copy Markdown
Member

(Based on #11776, ignore first commit)

See the commit messages, and the discussion in #11662.

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As is this is already a great improvement, awesome work!

I think we should merge this, and discuss later how/if expose this as part of the public API.

Add a function on the `FixtureManager` to register a fixture with
pytest. Currently this can only be done through `parsefactories`.

My aim is to eventually make something like this available to plugins,
as it's a pretty common need.
…egister_fixture`

Instead of modifying user objects like modules and classes that we
really shouldn't be touching, use the new `_register_fixture` internal
API to do it directly.
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.

2 participants