[py-svn] commit/pytest: hpk42: fix trial test failure and simplify todo->xfail conversion

Bitbucket commits-noreply at bitbucket.org
Wed Dec 28 18:35:48 CET 2011


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/990861605126/
changeset:   990861605126
user:        hpk42
date:        2011-12-28 18:35:38
summary:     fix trial test failure and simplify todo->xfail conversion
affected #:  1 file

diff -r 6cd04a7beadb4df14cf57e8f0f601cfd15613d5e -r 990861605126a337286674a2e4132907eaea8ceb _pytest/unittest.py
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -28,6 +28,8 @@
             x = getattr(self.obj, name)
             funcobj = getattr(x, 'im_func', x)
             transfer_markers(funcobj, cls, module)
+            if hasattr(funcobj, 'todo'):
+                pytest.mark.xfail(reason=str(funcobj.todo))(funcobj)
             yield TestCaseFunction(name, parent=self)
 
     def setup(self):
@@ -45,12 +47,6 @@
 class TestCaseFunction(pytest.Function):
     _excinfo = None
 
-    def __init__(self, name, parent):
-        super(TestCaseFunction, self).__init__(name, parent)
-        if hasattr(self._obj, 'todo'):
-            getattr(self._obj, 'im_func', self._obj).xfail = \
-                pytest.mark.xfail(reason=str(self._obj.todo))
-
     def setup(self):
         self._testcase = self.parent.obj(self.name)
         self._obj = getattr(self._testcase, self.name)

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