Skip to content

Commit

Permalink
PR review. Updated tests/marks/curio.py (removed unnecessary fixture)
Browse files Browse the repository at this point in the history
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
  • Loading branch information
cdeler and florimondmanca committed Aug 31, 2020
1 parent 46bdc25 commit 5604bf8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from httpcore._types import URL

from .marks.curio import curio_kernel_fixture # noqa: F401
from .marks.curio import curio_pytest_pycollect_makeitem, curio_pytest_pyfunc_call

PROXY_HOST = "127.0.0.1"
Expand Down
15 changes: 2 additions & 13 deletions tests/marks/curio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def curio_pytest_pycollect_makeitem(collector, name, obj):

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def curio_pytest_pyfunc_call(pyfuncitem):
"""Run curio marked test functions in a Curio kernel instead of a normal function call.
"""
"""Run curio marked test functions in a Curio kernel
instead of a normal function call."""
if pyfuncitem.get_closest_marker("curio"):
pyfuncitem.obj = wrap_in_sync(pyfuncitem.obj)
yield
Expand All @@ -40,14 +40,3 @@ def inner(**kwargs):
curio.Kernel().run(coro, shutdown=True)

return inner


# Fixture for explicitly running in Kernel instance.
@pytest.fixture(scope="session")
def curio_kernel_fixture(request):
"""Provide a Curio Kernel object for running co-routines."""
k = curio.Kernel(debug=[curio.debug.longblock, curio.debug.logcrash])
m = curio.monitor.Monitor(k)
request.addfinalizer(lambda: k.run(shutdown=True))
request.addfinalizer(m.close)
return k

0 comments on commit 5604bf8

Please sign in to comment.