From 72afbbbd710ea2a3e984cedd159ad0d77bf45f1d Mon Sep 17 00:00:00 2001 From: Wouter van Ackooy Date: Thu, 23 May 2013 12:21:40 +0200 Subject: [PATCH] Added new test to check on matching markers to full test names, which was possible before. Also adjusted check on number of deselected tests. --- testing/test_mark.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/testing/test_mark.py b/testing/test_mark.py index bbddf5476..cc5b3290e 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -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("()")