diff mbox

[5/6] tests: Add a way for the user to skip selenium tests

Message ID 1442938309-3195-6-git-send-email-damien.lespiau@intel.com
State Accepted
Headers show

Commit Message

Damien Lespiau Sept. 22, 2015, 4:11 p.m. UTC
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.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 patchwork/tests/browser.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stephen Finucane Sept. 22, 2015, 5:23 p.m. UTC | #1
> 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.

> 

> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>


Why not just add an additional tox target?
Damien Lespiau Sept. 22, 2015, 5:29 p.m. UTC | #2
On Tue, Sep 22, 2015 at 06:23:45PM +0100, Finucane, Stephen wrote:
> > 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.
> > 
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> 
> Why not just add an additional tox target?

In addition you mean? a target that would set the env variable?
Stephen Finucane Sept. 22, 2015, 5:44 p.m. UTC | #3
> On Tue, Sep 22, 2015 at 06:23:45PM +0100, Finucane, Stephen wrote:
> > > 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.
> > >
> > > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> >
> > Why not just add an additional tox target?
> 
> In addition you mean? a target that would set the env variable?

Actually, that wouldn't work as there doesn't seem to be a way to specify tests to skip (only tests to run). Two other items though:

* Use the '@unittest.skipIf' decorator
  https://docs.python.org/dev/library/unittest.html#skipping-tests-and-expected-failures
* Add documentation on this so people know about the option/how to enable it/why it exists

Stephen
diff mbox

Patch

diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py
index 9a6c4de..5047928 100644
--- a/patchwork/tests/browser.py
+++ b/patchwork/tests/browser.py
@@ -94,6 +94,10 @@  class SeleniumTestCase(StaticLiveServerTestCase):
     _SCREENSHOT_DIR = os.path.dirname(__file__) + '/../../selenium_screenshots'
 
     def setUp(self):
+        self.skip = os.getenv('PATCHWORK_SKIP_BROWSER_TESTS', None)
+        if self.skip:
+            self.skipTest("Disabled by environment variable")
+
         super(SeleniumTestCase, self).setUp()
 
         self.browser = os.getenv('SELENIUM_BROWSER', 'chrome')