diff --git a/conftest.py b/conftest.py index 632f6e2a0e4..4b8575813ee 100644 --- a/conftest.py +++ b/conftest.py @@ -17,7 +17,6 @@ 'pytest_plugins.settings_skip', 'pytest_plugins.rerun_rp.rerun_rp', 'pytest_plugins.fspath_plugins', - 'pytest_plugins.fixture_collection', 'pytest_plugins.factory_collection', 'pytest_plugins.requirements.update_requirements', 'pytest_plugins.sanity_plugin', diff --git a/pytest_plugins/fixture_collection.py b/pytest_plugins/fixture_collection.py deleted file mode 100644 index 6f61f2b3360..00000000000 --- a/pytest_plugins/fixture_collection.py +++ /dev/null @@ -1,39 +0,0 @@ -# Pytest Plugin to modify collection of test cases based on fixtures used by tests. -from robottelo.logging import collection_logger as logger - - -def pytest_addoption(parser): - """Add options for pytest to collect tests based on fixtures its using""" - help_text = ''' - Collects tests based on fixtures used by tests - - Usage: --uses-fixtures [options] - - Options: [ specific_fixture_name | list_of fixture names ] - - example: pytest tests/foreman --uses-fixtures target_sat module_target_sat - ''' - parser.addoption("--uses-fixtures", nargs='?', help=help_text) - - -def pytest_collection_modifyitems(items, config): - - if not config.getoption('uses_fixtures', False): - return - - filter_fixtures = config.getvalue('uses_fixtures') - fixtures_list = filter_fixtures.split(',') if ',' in filter_fixtures else [filter_fixtures] - selected = [] - deselected = [] - - for item in items: - if set(item.fixturenames).intersection(set(fixtures_list)): - selected.append(item) - else: - deselected.append(item) - logger.debug( - f'Selected {len(selected)} and deselected {len(deselected)} ' - f'tests based on given fixtures {fixtures_list} used by tests' - ) - config.hook.pytest_deselected(items=deselected) - items[:] = selected diff --git a/requirements.txt b/requirements.txt index ded6006ea87..4cead800f56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ pytest-services==2.2.1 pytest-mock==3.12.0 pytest-reportportal==5.3.0 pytest-xdist==3.5.0 +pytest-fixturecollection==0.1.1 pytest-ibutsu==2.2.4 PyYAML==6.0.1 requests==2.31.0