Skip to content

Enable Trio Mode through import * doesn't work when using same pytest hooks #141

@jordanlibrande

Description

@jordanlibrande

from pytest_trio.enable_trio_mode import * doesn't work properly if your conftest.py itself implements pytest_collection_modifyitems or pytest_fixture_setup hooks. It seems the hooks from pytest_trio get shadowed by your local function so the pytest_trio hooks no longer get found and called by pytest.

Maybe at least add this behavior (and a recommended workaround) to the documentation?

I unblocked by having my local hooks call the pytest_trio versions of these hooks internally. (Possibly pytest hookwrapper could also be used?)

Probably better would be to have pytest_trio's pytest_collection_modifyitems and pytest_fixture_setup be in the main pytest_trio plugin, and have their behavior be configurable? Then I think they'll always be collected by pytest.

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