[py-svn] r61314 - py/branch/pytestplugin/py/test/plugin

hpk at codespeak.net hpk at codespeak.net
Sat Jan 24 20:16:23 CET 2009


Author: hpk
Date: Sat Jan 24 20:16:22 2009
New Revision: 61314

Modified:
   py/branch/pytestplugin/py/test/plugin/pytest_xfail.py
Log:
the xfail plugin would like to use the xfile plugin ...


Modified: py/branch/pytestplugin/py/test/plugin/pytest_xfail.py
==============================================================================
--- py/branch/pytestplugin/py/test/plugin/pytest_xfail.py	(original)
+++ py/branch/pytestplugin/py/test/plugin/pytest_xfail.py	Sat Jan 24 20:16:22 2009
@@ -1,42 +1,16 @@
 """
 py.test xfail plugin for marking and reporting "expected to fail" tests. 
-
-example usage:
-
-    @py.test.xfail
-    def test_hello():
-        ...
-        assert 0
-
-you can also provide meta information 
-    @py.test.xfail("issue97")
+    @py.test.funcdict(xfail="needs refactoring")
     def test_hello():
         ...
         assert 0
-    
-
-plugin should work for distributed in a distributed setting as well. 
-for now, you will need to manually install the plugin remotely. 
-XXX see to transfer plugin to the remote side. 
 """
+import py
 
-def xfail(func=None, reason=None):
-    def xfaildecorator(func):
-        func.reason = reason 
-        return func
-    if func is not None:
-        return xfaildecorator(func)
-    return xfaildecorator
-    
 class Xfail:
-    version = "0.1" 
-
-    def pytest_namespace_extension(self):
-        return {'xfail': xfail}
-
-    def pytest_report_event(self, resultevent):
+    def pytest_progress_resultevent(self, resultevent):
         """ return category/verbose and shortletter. """
-        if 'xfail' in resultevent.funcdict:
+        if 'xfail' in resultevent.funcdict: #the 
             if resultevent.failed:
                 return "xfailed", "x"
             else:
@@ -45,6 +19,7 @@
     #def pytest_terminal_summary_category_sort(self, name1, name2):
     #    ... 
         
+    # a hook implemented called by the terminalreporter instance/plugin
     def pytest_terminal_summary_category(self, terminalreporter, categoryname, events):
         if categoryname == "xfailed":
             return True  # print nothing for tests that failed and were expected to fail 
@@ -60,3 +35,10 @@
 # ===============================================================================
 
 from py.__.test.testing import plugintester
+
+def test_generic():
+    py.test.skip("implement various bits above first")
+    impname = "py.__.test.plugin.pytest_xfail"
+    plugintester.nocalls(impname) 
+    tmpdir = plugintester.functional("py.__.test.plugin.pytest_xfail")
+    # XXX



More information about the pytest-commit mailing list