From e0c62b38e0dd0753625939269eb631fb04f6d94f Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 13 Sep 2019 17:10:41 +0100 Subject: [PATCH] Adopt newer molecule api Makes pytest-molecule work with the newer api exposed by molecule. --- pytest_molecule/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pytest_molecule/__init__.py b/pytest_molecule/__init__.py index 550f0b5..793b54c 100644 --- a/pytest_molecule/__init__.py +++ b/pytest_molecule/__init__.py @@ -8,7 +8,12 @@ import sys from pipes import quote import yaml -from molecule.config import molecule_drivers + +try: + from molecule.api import drivers +except ImportError: + # molecule<3.0 + from molecule.api import molecule_drivers as drivers def pytest_addoption(parser): @@ -34,7 +39,7 @@ def pytest_addoption(parser): def pytest_configure(config): config.option.molecule = {} - for driver in molecule_drivers(): + for driver in drivers(): config.addinivalue_line( "markers", "{0}: mark test to run only when {0} is available".format(driver) )