From: Stephen Finucane Date: Sat, 7 Nov 2015 01:28:56 +0000 (+0000) Subject: tests: Don't use exceptions for flow control X-Git-Tag: v1.1.0~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=984cba39a52a0af721c8789370c0f1674464a432;p=thirdparty%2Fpatchwork.git 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 --- diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py index 80285dbd..256a4d9e 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)