Merge "Avoid ImportError when selenium is missing."
This commit is contained in:
commit
46ebda3d5d
@ -18,6 +18,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
@ -32,8 +33,19 @@ from django import test as django_test
|
|||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.utils import unittest
|
from django.utils import unittest
|
||||||
|
|
||||||
from selenium.webdriver.firefox.webdriver import WebDriver
|
LOG = logging.getLogger(__name__)
|
||||||
from selenium.webdriver.support import ui as selenium_ui
|
|
||||||
|
|
||||||
|
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
|
import mox
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user