conftest: Skip functional tests if splinter not importable

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2021-10-06 13:58:18 -04:00 committed by Sunil Mohan Adapa
parent b4e3824a4a
commit 4f79096d07
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -11,6 +11,18 @@ from unittest.mock import patch
import pytest
try:
importlib.import_module('splinter')
_splinter_available = True
except ImportError:
_splinter_available = False
def pytest_ignore_collect(path, config):
"""Ignore functional tests when splinter is not available."""
if path.basename == 'test_functional.py':
return not _splinter_available
def pytest_addoption(parser):
"""Add a command line option to run functional tests."""