Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup: drop 'request' argument from async fixtures #270

Merged
merged 1 commit into from Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions pytest_asyncio/plugin.py
Expand Up @@ -232,7 +232,6 @@ def _hypothesis_test_wraps_coroutine(function: Any) -> bool:
class FixtureStripper:
"""Include additional Fixture, and then strip them"""

REQUEST = "request"
EVENT_LOOP = "event_loop"

def __init__(self, fixturedef: FixtureDef) -> None:
Expand Down Expand Up @@ -330,15 +329,11 @@ def pytest_fixture_setup(

fixture_stripper = FixtureStripper(fixturedef)
fixture_stripper.add(FixtureStripper.EVENT_LOOP)
fixture_stripper.add(FixtureStripper.REQUEST)

def wrapper(*args, **kwargs):
loop = fixture_stripper.get_and_strip_from(
FixtureStripper.EVENT_LOOP, kwargs
)
request = fixture_stripper.get_and_strip_from(
FixtureStripper.REQUEST, kwargs
)

gen_obj = generator(*args, **kwargs)

Expand Down Expand Up @@ -452,7 +447,7 @@ def pytest_runtest_setup(item: pytest.Item) -> None:
if "event_loop" in fixturenames:
fixturenames.remove("event_loop")
fixturenames.insert(0, "event_loop")
obj = getattr(item, 'obj', None)
obj = getattr(item, "obj", None)
if (
item.get_closest_marker("asyncio") is not None
and not getattr(obj, "hypothesis", False)
Expand Down