Skip to content

Conversation

@kruvasyan
Copy link
Contributor

No description provided.


Note: Async fixtures require `pytest-asyncio` or another async pytest plugin to be installed.

### Lifespan Support
Copy link
Owner

Choose a reason for hiding this comment

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

Whenever we write docs for features, it's much better to write them in terms of features, not implementation details — this turns them into true problem solving guides instead of technical documentation.

In this case, the section and notes within it should probably refer to "setup and tear down" instead of lifespan


from pytest_fixture_classes import fixture_class

execution_log: list[str] = []
Copy link
Owner

@zmievsa zmievsa Oct 18, 2025

Choose a reason for hiding this comment

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

Does it maybe make sense to keep the execution log per test? The whole clearing thing feels like an anti-pattern here, removing the ability to parallelize tests. It isn't a big problem for this library but I do feel like a testing library should be promoting the right patterns.

has_lifespan = hasattr(fixture_cls, "lifespan")
is_async_lifespan = False

if has_lifespan:
Copy link
Owner

Choose a reason for hiding this comment

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

How about just inserting a lifespan that does nothing in case there is no lifespan? It should make the code much simpler and less duplicated

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