pytest-twisted icon indicating copy to clipboard operation
pytest-twisted copied to clipboard

Support no-call async_fixture and async_yield_fixture to align with pytest.fixture

Open cdunklau opened this issue 5 years ago • 0 comments

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.

cdunklau avatar Feb 18 '20 01:02 cdunklau