I have a project using pytest-twisted, and I'd like to write some tests using hypothesis' stateful testing. Since the control-flow of stateful testing is handled by hypothesis, I use pytest_twisted.blockon in the tests to interact with twisted.
However, this doesn't work by default, as pytest-twisted forces every test function to run in the reactor greenlet. There is a comment in the pytest_pyfunc_call hook suggesting this change:
|
def pytest_pyfunc_call(pyfuncitem): |
|
"""Interface to async test call handler.""" |
|
# TODO: only handle 'our' tests? what is the point of handling others? |
|
# well, because our interface allowed people to return deferreds |
|
# from arbitrary tests so we kinda have to keep this up for now |
|
_run_inline_callbacks(_async_pytest_pyfunc_call, pyfuncitem) |
|
return not None |
This is perhaps a duplicate of #64.
I have a project using pytest-twisted, and I'd like to write some tests using hypothesis' stateful testing. Since the control-flow of stateful testing is handled by hypothesis, I use
pytest_twisted.blockonin the tests to interact with twisted.However, this doesn't work by default, as
pytest-twistedforces every test function to run in the reactor greenlet. There is a comment in thepytest_pyfunc_callhook suggesting this change:pytest-twisted/pytest_twisted.py
Lines 357 to 363 in cc03b11
This is perhaps a duplicate of #64.