diff --git a/python/pytest_plugins/pytest_operator_groups/pytest_operator_groups/plugin.py b/python/pytest_plugins/pytest_operator_groups/pytest_operator_groups/plugin.py index 4cf246d2..70923236 100644 --- a/python/pytest_plugins/pytest_operator_groups/pytest_operator_groups/plugin.py +++ b/python/pytest_plugins/pytest_operator_groups/pytest_operator_groups/plugin.py @@ -21,6 +21,9 @@ def pytest_configure(config): ) if config.option.collect_groups: config.option.collectonly = True + assert ( + config.option.group is None + ), "--group should not be used with --collect-groups" def _get_group_number(function) -> typing.Optional[int]: @@ -77,6 +80,7 @@ class Group: file.write(output) +@pytest.hookimpl(trylast=True) # Run after tests are deselected with `-m` def pytest_collection_modifyitems(config, items): if config.option.collect_groups: _collect_groups(items)