fix issue30 (the second time)

put module globals into namespace for xfail and skipif expressions
This commit is contained in:
holger krekel
2011-03-03 23:22:55 +01:00
parent 682773e0cb
commit 070c73ff2f
7 changed files with 102 additions and 19 deletions
+30
View File
@@ -497,4 +497,34 @@ def test_errors_in_xfail_skip_expressions(testdir):
"*1 pass*2 error*",
])
def test_xfail_skipif_with_globals(testdir):
testdir.makepyfile("""
import pytest
x = 3
@pytest.mark.skipif("x == 3")
def test_skip1():
pass
@pytest.mark.xfail("x == 3")
def test_boolean():
assert 0
""")
result = testdir.runpytest("-rsx")
result.stdout.fnmatch_lines([
"*SKIP*x == 3*",
"*XFAIL*test_boolean*",
"*x == 3*",
])
def test_direct_gives_error(testdir):
testdir.makepyfile("""
import pytest
@pytest.mark.skipif(True)
def test_skip1():
pass
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*1 error*",
])