diff --git a/pytest_mh/_private/marks.py b/pytest_mh/_private/marks.py index 6224060..0ccd659 100644 --- a/pytest_mh/_private/marks.py +++ b/pytest_mh/_private/marks.py @@ -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: diff --git a/pytest_mh/_private/plugin.py b/pytest_mh/_private/plugin.py index 02611da..bfddd89 100644 --- a/pytest_mh/_private/plugin.py +++ b/pytest_mh/_private/plugin.py @@ -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