Skip to content

Instantly share code, notes, and snippets.

@davehunt
Created June 25, 2012 13:11
Show Gist options
  • Save davehunt/2988477 to your computer and use it in GitHub Desktop.
Save davehunt/2988477 to your computer and use it in GitHub Desktop.
Conditional xfails for pytest-mozwebqa tests.
import pytest
class TestConditionalXFails:
@pytest.mark.xfail("config.getvalue('platform') == 'MAC'")
def test_xfail_platform(self, mozwebqa):
assert False
@pytest.mark.xfail("config.getvalue('browser_name') == 'firefox'")
def test_xfail_browser_name(self, mozwebqa):
assert False
@pytest.mark.xfail("config.getvalue('browser_name') == 'firefox' and "
"int(config.getvalue('browser_version')) >= 10 and "
"config.getvalue('platform') == 'MAC'")
def test_xfail_browser_name_and_version_and_platform(self, mozwebqa):
assert False
@klrmn
Copy link

klrmn commented Aug 1, 2012

import pytest

class TestSkipIf:

@pytest.mark.skipif("config.getvalue('browser_name') != 'ie'")
def test_this_in_ie_only(self, mozwebqa):
    pass

@pytest.mark.skipif("config.getvalue('browsername') != 'firefox'")
def test_this_in_firefox_only(self, mozwebqa):
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment