Update skippings tests for better coverage
This commit is contained in:
parent
abc27f56fc
commit
d1628944a6
|
@ -399,6 +399,16 @@ class TestSkip(object):
|
||||||
rec = testdir.inline_run()
|
rec = testdir.inline_run()
|
||||||
rec.assertoutcome(skipped=2, passed=1)
|
rec.assertoutcome(skipped=2, passed=1)
|
||||||
|
|
||||||
|
def test_skips_on_false_string(self, testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
@pytest.mark.skip('False')
|
||||||
|
def test_foo():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
rec = testdir.inline_run()
|
||||||
|
rec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
def test_skip_no_reason(self, testdir):
|
def test_skip_no_reason(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -430,14 +440,19 @@ class TestSkip(object):
|
||||||
@pytest.mark.skip
|
@pytest.mark.skip
|
||||||
def test_foo():
|
def test_foo():
|
||||||
pass
|
pass
|
||||||
@pytest.mark.skip(reason="none")
|
@pytest.mark.skip(reason="no reason")
|
||||||
def test_bar() :
|
def test_bar():
|
||||||
pass
|
pass
|
||||||
def test_baz():
|
def test_baz():
|
||||||
assert True
|
assert True
|
||||||
""")
|
""")
|
||||||
rec = testdir.inline_run()
|
# cant use assertoutcome because we cant
|
||||||
rec.assertoutcome(passed=1, skipped=2)
|
# also check the reason
|
||||||
|
result = testdir.runpytest('-rs')
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*no reason*",
|
||||||
|
"*1 passed*2 skipped*",
|
||||||
|
])
|
||||||
|
|
||||||
class TestSkipif(object):
|
class TestSkipif(object):
|
||||||
def test_skipif_conditional(self, testdir):
|
def test_skipif_conditional(self, testdir):
|
||||||
|
|
Loading…
Reference in New Issue