Created
October 10, 2013 20:51
-
-
Save hpk42/6925467 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# content of conftest.py | |
import pytest | |
@pytest.mark.tryfirst | |
def pytest_pyfunc_call(pyfuncitem): | |
marker = pyfuncitem.get_marker("skip_if_eval") | |
if marker is not None: | |
class Mapping: | |
def __getitem__(self, name): | |
if name not in pyfuncitem.fixturenames: | |
raise KeyError | |
return pyfuncitem._request.getfuncargvalue(name) | |
expr = marker.args[0] | |
if eval(expr, {}, Mapping()): | |
pytest.skip("skipped because of expression %r" % expr) | |
# content of test file | |
import pytest | |
@pytest.mark.skip_if_eval("tmpdir.basename") | |
def test_hello(tmpdir): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment