diff options
| author | Florian Apolloner <florian@apolloner.eu> | 2013-09-14 22:58:30 +0200 |
|---|---|---|
| committer | Florian Apolloner <florian@apolloner.eu> | 2013-09-14 22:58:30 +0200 |
| commit | 3c5775d36f7e431d9691829a78580873111cb714 (patch) | |
| tree | da225a7ae9e19665234458924d7e8cd84217699d /django/contrib/admin/tests.py | |
| parent | bac86ad1a350ba99464e9a24a589e7833a901730 (diff) | |
Delayed initialization of Selenium webdrivers.
If setUpClass throws an exception (in this case "Address already in use" if the
super call can't find any open port to bind too) tearDownClass is not called.
This results in open browser windows from the webdriver, hence we only construct
it once we are sure there is no code afterwards which could error out.
Diffstat (limited to 'django/contrib/admin/tests.py')
| -rw-r--r-- | django/contrib/admin/tests.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index 4b424b72cd..24d8937eed 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -22,11 +22,12 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerCase): if not os.environ.get('DJANGO_SELENIUM_TESTS', False): raise SkipTest('Selenium tests not requested') try: - cls.selenium = import_by_path(cls.webdriver_class)() + webdriver_class = import_by_path(cls.webdriver_class) except Exception as e: raise SkipTest('Selenium webdriver "%s" not installed or not ' 'operational: %s' % (cls.webdriver_class, str(e))) super(AdminSeleniumWebDriverTestCase, cls).setUpClass() + cls.selenium = webdriver_class() @classmethod def tearDownClass(cls): |
