summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-03-27 14:19:31 -0400
committerTim Graham <timograham@gmail.com>2014-03-27 14:19:31 -0400
commite2ac0203d9fceccf0e76b547a58c35793c620b71 (patch)
tree5d7f45837656277d4fe092c2f1ee4e2059139934
parentdadf2ee75f88653b94b9c05a3118fd1590853e77 (diff)
Skipped JavascriptI18nTests if Firefox isn't properly configured.
Code borrowed from django.contrib.admin.tests. Without this, the class can throw an exception with something like "The browser appears to have exited before we could connect. The output was: Error: no display specified"
-rw-r--r--tests/view_tests/tests/test_i18n.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index d837f4bc90..fac1d7d331 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -11,13 +11,9 @@ from django.test import (
LiveServerTestCase, TestCase, modify_settings, override_settings)
from django.utils import six
from django.utils._os import upath
+from django.utils.module_loading import import_string
from django.utils.translation import override, LANGUAGE_SESSION_KEY
-try:
- from selenium.webdriver.firefox import webdriver as firefox
-except ImportError:
- firefox = None
-
from ..urls import locale_dir
@@ -211,16 +207,20 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
-@unittest.skipUnless(firefox, 'Selenium not installed')
class JavascriptI18nTests(LiveServerTestCase):
# The test cases use translations from these apps.
available_apps = ['django.contrib.admin', 'view_tests']
urls = 'view_tests.urls'
+ webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
@classmethod
def setUpClass(cls):
- cls.selenium = firefox.WebDriver()
+ try:
+ cls.selenium = import_string(cls.webdriver_class)()
+ except Exception as e:
+ raise unittest.SkipTest('Selenium webdriver "%s" not installed or '
+ 'not operational: %s' % (cls.webdriver_class, str(e)))
super(JavascriptI18nTests, cls).setUpClass()
@classmethod