diff options
author | Stephen Finucane <stephen.finucane@intel.com> | 2015-11-07 01:28:56 +0000 |
---|---|---|
committer | Stephen Finucane <stephen.finucane@intel.com> | 2015-11-07 04:13:29 +0000 |
commit | 984cba39a52a0af721c8789370c0f1674464a432 (patch) | |
tree | 159b7e0560c4ff47a9e72e7ed8073b964d4f058a | |
parent | 5cdbbbca15095ed7e2c1bfc527c709997c2e7f48 (diff) | |
download | patchwork-984cba39a52a0af721c8789370c0f1674464a432.tar patchwork-984cba39a52a0af721c8789370c0f1674464a432.tar.gz |
tests: Don't use exceptions for flow control
Using exceptions for flow control is bad. Be consistent and instead
use proper functions to check for version support. This also allows
the use of tools to automatically identify feature flags when
removing support for Django versions in the future.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
-rw-r--r-- | patchwork/tests/browser.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py index 80285db..256a4d9 100644 --- a/patchwork/tests/browser.py +++ b/patchwork/tests/browser.py @@ -21,10 +21,11 @@ import errno import os import time -try: # django 1.7+ - from django.contrib.staticfiles.testing import StaticLiveServerTestCase -except: +import django +if django.VERSION < (1, 7): from django.test import LiveServerTestCase as StaticLiveServerTestCase +else: + from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium.common.exceptions import ( NoSuchElementException, StaleElementReferenceException, TimeoutException) |