Skip to content

Commit

Permalink
add tests for pytest-dev#3441
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed May 3, 2018
1 parent a5cf55d commit 88f84f5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,3 +927,35 @@ def test_parameterset_for_parametrize_marks(testdir, mark):
def test_parameterset_for_parametrize_bad_markname(testdir):
with pytest.raises(pytest.UsageError):
test_parameterset_for_parametrize_marks(testdir, 'bad')


def test_mark_expressions_no_smear(testdir):
testdir.makepyfile("""
import pytest
class BaseTests(object):
def test_something(self):
pass
@pytest.mark.FOO
class TestFooClass(BaseTests):
pass
@pytest.mark.BAR
class TestBarClass(BaseTests):
pass
""")

reprec = testdir.inline_run("-m", 'FOO')
passed, skipped, failed = reprec.countoutcomes()
dlist = reprec.getcalls("pytest_deselected")
assert passed == 1
assert skipped == failed == 0
deselected_tests = dlist[0].items
assert len(deselected_tests) == 1

# keywords smear
reprec_keywords = testdir.inline_run("-k", 'FOO')
passed_k, skipped_k, failed_k = reprec_keywords.countoutcomes()
assert passed_k == 2
assert skipped_k == failed_k == 0

0 comments on commit 88f84f5

Please sign in to comment.