Added new test to check on matching markers to full test names, which was possible before. Also adjusted check on number of deselected tests.

This commit is contained in:
Wouter van Ackooy 2013-05-23 12:21:40 +02:00
parent 583c736f0c
commit 72afbbbd71
1 changed files with 20 additions and 1 deletions

View File

@ -345,6 +345,24 @@ class TestFunctional:
assert l[0].args == ("pos0",)
assert l[1].args == ("pos1",)
def test_no_marker_match_on_unmarked_names(self, testdir):
p = testdir.makepyfile("""
import pytest
@pytest.mark.shouldmatch
def test_marked():
assert 1
def test_unmarked():
assert 1
""")
reprec = testdir.inline_run("-m", "test_unmarked", p)
passed, skipped, failed = reprec.listoutcomes()
assert len(passed) + len(skipped) + len(failed) == 0
dlist = reprec.getcalls("pytest_deselected")
deselected_tests = dlist[0].items
assert len(deselected_tests) == 2
def test_keywords_at_node_level(self, testdir):
p = testdir.makepyfile("""
import pytest
@ -453,7 +471,8 @@ class TestKeywordSelection:
passed, skipped, failed = reprec.countoutcomes()
dlist = reprec.getcalls("pytest_deselected")
assert passed + skipped + failed == 0
assert len(dlist) == 1
deselected_tests = dlist[0].items
assert len(deselected_tests) == 1
assert_test_is_not_selected("__")
assert_test_is_not_selected("()")