Add initial tests using skip with allow_module_level kwarg

This commit is contained in:
George Y. Kussumoto 2017-10-01 18:39:14 -03:00
parent 79d3353081
commit 06307be15d
1 changed files with 34 additions and 0 deletions

View File

@ -1005,6 +1005,40 @@ def test_module_level_skip_error(testdir):
) )
def test_module_level_skip_with_allow_module_level(testdir):
"""
Verify that using pytest.skip(allow_module_level=True) is allowed
"""
testdir.makepyfile("""
import pytest
pytest.skip("skip_module_level", allow_module_level=True)
def test_func():
assert 0
""")
result = testdir.runpytest("-rxs")
result.stdout.fnmatch_lines(
"*SKIP*skip_module_level"
)
def test_invalid_skip_keyword_parameter(testdir):
"""
Verify that using pytest.skip() with unknown parameter raises an error
"""
testdir.makepyfile("""
import pytest
pytest.skip("skip_module_level", unknown=1)
def test_func():
assert 0
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines(
"*TypeError:*['unknown']*"
)
def test_mark_xfail_item(testdir): def test_mark_xfail_item(testdir):
# Ensure pytest.mark.xfail works with non-Python Item # Ensure pytest.mark.xfail works with non-Python Item
testdir.makeconftest(""" testdir.makeconftest("""