Skip to content

Commit

Permalink
Remove --delegated pytest option
Browse files Browse the repository at this point in the history
This extension prevented execution of pytest from root of project and
introduced risks of bypassing funtional testing by default.

If someone want to avoid delegate testing the use of pytest marks is
a much easier approach, one that does not need extra code.

Signed-off-by: Sorin Sbarnea <[email protected]>
  • Loading branch information
ssbarnea committed Nov 30, 2019
1 parent 26ae0e8 commit ea52b22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
6 changes: 0 additions & 6 deletions molecule/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ def molecule_ephemeral_directory(_fixture_uuid):
)


def pytest_addoption(parser):
parser.addoption(
'--delegated', action='store_true', help='Run delegated driver tests.'
)


def pytest_collection_modifyitems(items, config):

marker = config.getoption('-m')
Expand Down
13 changes: 2 additions & 11 deletions molecule/test/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,11 @@ def with_scenario(request, scenario_to_test, driver_name, scenario_name, skip_te

@pytest.fixture
def skip_test(request, driver_name):
msg_tmpl = (
"Ignoring '{}' tests for now"
if driver_name == 'delegated'
else "Skipped '{}' not supported"
)
msg_tmpl = "Skipped '{}' not supported"
support_checks_map = {
'docker': supports_docker,
'podman': lambda: min_ansible("2.8.6") and platform.system() != 'Darwin',
'delegated': demands_delegated,
'delegated': lambda: True,
}
try:
check_func = support_checks_map[driver_name]
Expand Down Expand Up @@ -264,8 +260,3 @@ def min_ansible(version):
except ImportError as exception:
LOG.error('Unable to parse Ansible version', exc_info=exception)
return False


@pytest.helpers.register
def demands_delegated():
return pytest.config.getoption('--delegated')

0 comments on commit ea52b22

Please sign in to comment.