tests: Don't error during collection if selenium is not installed

This fixes the current pipeline failures.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2023-04-01 19:39:52 +05:30 committed by James Valleroy
parent 485107604f
commit f25e2706d2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -13,15 +13,16 @@ import pytest
try:
importlib.import_module('splinter')
_splinter_available = True
importlib.import_module('selenium')
_functional_libs_available = True
except ImportError:
_splinter_available = False
_functional_libs_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
return not _functional_libs_available
def pytest_addoption(parser):