diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 3853e8751..9253f20db 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -18,6 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import os import socket @@ -32,8 +33,19 @@ from django import test as django_test from django.test.client import RequestFactory from django.utils import unittest -from selenium.webdriver.firefox.webdriver import WebDriver -from selenium.webdriver.support import ui as selenium_ui +LOG = logging.getLogger(__name__) + + +try: + from selenium.webdriver.firefox.webdriver import WebDriver + from selenium.webdriver.support import ui as selenium_ui +except ImportError as e: + # NOTE(saschpe): Several distribution can't ship selenium due to it's + # non-free license. So they have to patch it out of test-requirements.txt + # Avoid import failure and force not running selenium tests. + LOG.warning("{0}, force WITH_SELENIUM=False".format(str(e))) + os.environ['WITH_SELENIUM'] = '' + import mox