[py-svn] commit/pytest: hpk42: fix issue160 a failing setup of an xfail-marked tests should
Bitbucket
commits-noreply at bitbucket.org
Tue Jun 19 23:48:47 CEST 2012
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/247f79e22b50/
changeset: 247f79e22b50
user: hpk42
date: 2012-06-19 23:48:39
summary: fix issue160 a failing setup of an xfail-marked tests should
be reported as xfail (not xpass)
affected #: 4 files
diff -r 66d31afddbe676427298a4badbcb9696102411b1 -r 247f79e22b50601a1af3a18a137ecdc5c3278e64 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Changes between 2.2.4 and 2.2.5.dev
-----------------------------------
+- fix issue160: a failing setup of an xfail-marked tests should
+ be reported as xfail (not xpass)
- fix issue128: show captured output when capsys/capfd are used
- pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken
diff -r 66d31afddbe676427298a4badbcb9696102411b1 -r 247f79e22b50601a1af3a18a137ecdc5c3278e64 _pytest/skipping.py
--- a/_pytest/skipping.py
+++ b/_pytest/skipping.py
@@ -110,6 +110,7 @@
return expl
+ at pytest.mark.tryfirst
def pytest_runtest_setup(item):
if not isinstance(item, pytest.Function):
return
diff -r 66d31afddbe676427298a4badbcb9696102411b1 -r 247f79e22b50601a1af3a18a137ecdc5c3278e64 testing/test_skipping.py
--- a/testing/test_skipping.py
+++ b/testing/test_skipping.py
@@ -556,3 +556,19 @@
"*xfail(*conditions, reason=None, run=True)*expected failure*",
])
+
+def test_xfail_test_setup_exception(testdir):
+ testdir.makeconftest("""
+ def pytest_runtest_setup():
+ 0 / 0
+ """)
+ p = testdir.makepyfile("""
+ import pytest
+ @pytest.mark.xfail
+ def test_func():
+ assert 0
+ """)
+ result = testdir.runpytest(p)
+ assert result.ret == 0
+ assert 'xfailed' in result.stdout.str()
+ assert 'xpassed' not in result.stdout.str()
diff -r 66d31afddbe676427298a4badbcb9696102411b1 -r 247f79e22b50601a1af3a18a137ecdc5c3278e64 tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -77,4 +77,4 @@
python_files=test_*.py *_test.py
python_classes=Test Acceptance
python_functions=test
-pep8ignore = E401
+pep8ignore = E401 E225 E261 E128 E124
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list