Skip to content

Commit

Permalink
test: prevent running functional tests when not installed
Browse files Browse the repository at this point in the history
Running functional tests require molecule package to be installed, so
we now test for it and fail fast the testing if needed.

This should simplify development by avoiding confusing errors in
individual tests. Only functional tests are affected so we apply this
requirement only to them.
  • Loading branch information
ssbarnea committed Jan 5, 2020
1 parent 31110a6 commit b21671f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions molecule/test/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@
IS_TRAVIS = os.getenv('TRAVIS') and os.getenv('CI')


@pytest.fixture(scope="session", autouse=True)
def require_installed_package():
import pkg_resources

try:
pkg_resources.require("molecule")
except Exception as e:
pytest.fail(
"Functional tests require molecule package to be installed: {}".format(e)
)


def _env_vars_exposed(env_vars, env=os.environ):
"""Check if environment variables are exposed and populated."""
for env_var in env_vars:
Expand Down

0 comments on commit b21671f

Please sign in to comment.