From: Damien Lespiau Date: Tue, 8 Sep 2015 20:54:02 +0000 (+0100) Subject: tests: Add a way for the user to skip selenium tests X-Git-Tag: v1.1.0~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5488850ea68d8b6de742e7c643fe35ef68a11d8;p=thirdparty%2Fpatchwork.git tests: Add a way for the user to skip selenium tests It's a bit more convoluted to setup the test environment to work with selenium (eg. needs a browser installed and Xorg running, ...). It's possible someone would want to skip those. v2: Use 'PW' prefix rather than 'PATCHWORK', per existing test parameters, and pass said variable through tox Signed-off-by: Damien Lespiau Signed-off-by: Stephen Finucane --- diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py index 18450001..80285dbd 100644 --- a/patchwork/tests/browser.py +++ b/patchwork/tests/browser.py @@ -99,6 +99,10 @@ class SeleniumTestCase(StaticLiveServerTestCase): _SCREENSHOT_DIR = os.path.dirname(__file__) + '/../../selenium_screenshots' def setUp(self): + self.skip = os.getenv('PW_SKIP_BROWSER_TESTS', None) + if self.skip: + self.skipTest('Disabled by environment variable') + super(SeleniumTestCase, self).setUp() self.browser = os.getenv('SELENIUM_BROWSER', 'chrome') diff --git a/tox.ini b/tox.ini index 8647cf37..823d1dc8 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ commands = passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY PW_TEST_DB_USER PW_TEST_DB_PASS - DISPLAY SELENIUM_BROWSER + DISPLAY SELENIUM_BROWSER PW_SKIP_BROWSER_TESTS [testenv:pep8] basepython = python2.7