diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2017-03-10 15:54:05 -0300 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2017-03-10 15:54:05 -0300 |
commit | 1e0cf5ce4dcd8b110a45261595d69a502dd0226a (patch) | |
tree | e5b7993a41db97332a15920f1fa7642ac31750e3 /testing/test_skipping.py | |
parent | 0c94f517a18bc135fe80a07a64c8c74c27b41dcb (diff) | |
parent | 906b40fbb209916ea13199d5391c2e64b3587103 (diff) | |
download | pytest-1e0cf5ce4dcd8b110a45261595d69a502dd0226a.tar.gz |
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/pytester.py
Diffstat (limited to 'testing/test_skipping.py')
-rw-r--r-- | testing/test_skipping.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 6a8d147ad..f621a010f 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -969,3 +969,26 @@ def test_module_level_skip_error(testdir): result.stdout.fnmatch_lines( "*Using pytest.skip outside of a test is not allowed*" ) + + +def test_mark_xfail_item(testdir): + # Ensure pytest.mark.xfail works with non-Python Item + testdir.makeconftest(""" + import pytest + + class MyItem(pytest.Item): + nodeid = 'foo' + def setup(self): + marker = pytest.mark.xfail(True, reason="Expected failure") + self.add_marker(marker) + def runtest(self): + assert False + + def pytest_collect_file(path, parent): + return MyItem("foo", parent) + """) + result = testdir.inline_run() + passed, skipped, failed = result.listoutcomes() + assert not failed + xfailed = [r for r in skipped if hasattr(r, 'wasxfail')] + assert xfailed |