pytest-twisted
pytest-twisted copied to clipboard
Support no-call async_fixture and async_yield_fixture to align with pytest.fixture
Currently, you must call pytest_twisted.async_fixture
and pytest_twisted.async_yield_fixture
, and (until #74 fixes it) the readme demonstrates no-call semantics. I propose allowing this form by mimicking pytest.fixtures
's behavior, to improve consistency and UX.
It looks like pytest.fixture
treats its first argument as either the fixture scope name if it's a str
, and otherwise assumes it's the fixture function:
https://github.com/pytest-dev/pytest/blob/fd1a51a23fa687cf344f3506dff6cde0166faf2c/src/_pytest/fixtures.py#L1029-L1068
At first glance, I think this is a reasonable approach, and should be relatively straightforward to implement.