Skip to content

Don't run unmarked tests in the reactor greenlet. #141

Description

@tomprince

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions