Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
rhugonnet committed Jun 8, 2024
1 parent 08c4d69 commit 82767f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from pytest import DoctestItem


# To order test modules logically during execution
def pytest_collection_modifyitems(items):
def pytest_collection_modifyitems(items): # type: ignore
"""Modifies test items in place to ensure test modules run in a given order."""

# Ensure test_delayed runs last to avoid TearDown errors:
Expand All @@ -19,8 +20,9 @@ def pytest_collection_modifyitems(items):
module_names = list(module_mapping.values())
module_items = list(module_mapping.keys())

module_items_reordered = [it for k, it in enumerate(module_items) if module_names[k] != "test_delayed"] + \
[it for k, it in enumerate(module_items) if module_names[k] == "test_delayed"]
module_items_reordered = [it for k, it in enumerate(module_items) if module_names[k] != "test_delayed"] + [
it for k, it in enumerate(module_items) if module_names[k] == "test_delayed"
]

# And write back items in that order, with doctests first
items[:] = nonmodule_items + module_items_reordered

0 comments on commit 82767f4

Please sign in to comment.