Skip to content

Commit

Permalink
single run feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lavu committed Feb 17, 2025
1 parent e6ceecd commit 31edffd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pytest_mh/_private/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from .multihost import MultihostRole


# TODO: Should I look at the plugins, like mark.importance and create a single_run mark?

class TopologyMark(object):
"""
Topology mark is used to describe test case requirements. It defines:
Expand Down
14 changes: 14 additions & 0 deletions pytest_mh/_private/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,20 @@ def pytest_collection_modifyitems(self, config: pytest.Config, items: list[pytes
# Sort required host by name to provide deterministic runs
self.required_hosts = sorted(required_hosts_set, key=lambda x: x.hostname)

@pytest.hookimpl(hookwrapper=True)
def pytest_collection_modifyitems_single_run(self, config: pytest.Config, items: list[pytest.Item]) -> None:
"""
TODO: Write single run hook
1. Iterate through items, create list with test case name and topology
2. If test case name is new, add to list
3. If preferred topology parameter is defined, add to list or replace item in list
"""
data: MultihostItemData | None = None
selected: list[pytest.Item] = []
skipped: list[pytest.Item] = []
mapped: dict[str, list[pytest.Item]] = {}

@pytest.hookimpl(hookwrapper=True)
def pytest_collection_finish(self, session: pytest.Session) -> Generator:
# Log required hosts
Expand Down

0 comments on commit 31edffd

Please sign in to comment.