Message ID | 1442938309-3195-6-git-send-email-damien.lespiau@intel.com |
---|---|
State | Accepted |
Headers | show |
> 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?
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?
> 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 --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')
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(+)