Skip to content

Commit

Permalink
Switch tryfirst/trylast to hookimpl.
Browse files Browse the repository at this point in the history
tryfirst and trylast are deprecated in newer versions
of pytest, so use the hookimpl here.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Feb 13, 2024
1 parent c27c87f commit d9ffd80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions launch_pytest/launch_pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def from_parent(cls, *args, **kwargs):
# Part of this function was adapted from
# https://github.com/pytest-dev/pytest-asyncio/blob/f21e0da345f877755b89ff87b6dcea70815b4497/pytest_asyncio/plugin.py#L37-L50.
# See their license https://github.com/pytest-dev/pytest-asyncio/blob/master/LICENSE.
@pytest.mark.tryfirst
@pytest.hookimpl(tryfirst=True)
def pytest_pycollect_makeitem(collector, name, obj):
"""Collect coroutine based launch tests."""
if collector.funcnamefilter(name) and is_valid_test_item(obj):
Expand Down Expand Up @@ -275,7 +275,7 @@ def get_fixture_params(item):
return get_fixture_params(left_item) == get_fixture_params(right_item)


@pytest.mark.trylast
@pytest.hookimpl(trylast=True)
def pytest_collection_modifyitems(session, config, items):
"""Move shutdown tests after normal tests."""
def enumerate_reversed(sequence):
Expand Down

0 comments on commit d9ffd80

Please sign in to comment.