[pypy-svn] r70757 - in pypy/trunk/pypy: interpreter objspace/test

afa at codespeak.net afa at codespeak.net
Thu Jan 21 18:36:54 CET 2010


Author: afa
Date: Thu Jan 21 18:36:53 2010
New Revision: 70757

Modified:
   pypy/trunk/pypy/interpreter/gateway.py
   pypy/trunk/pypy/objspace/test/test_descriptor.py
Log:
It's actually possible to mark applevel tests with @py.test.mark.xfail,
with just a little hack in the gateway.


Modified: pypy/trunk/pypy/interpreter/gateway.py
==============================================================================
--- pypy/trunk/pypy/interpreter/gateway.py	(original)
+++ pypy/trunk/pypy/interpreter/gateway.py	Thu Jan 21 18:36:53 2010
@@ -1084,6 +1084,11 @@
     """ 
     if not isinstance(source, str): 
         source = str(py.code.Source(source).strip())
+        while source.startswith('@py.test.mark.'):
+            # these decorators are known to return the same function
+            # object, we may ignore them
+            assert '\n' in source
+            source = source[source.find('\n') + 1:]
         assert source.startswith("def "), "can only transform functions" 
         source = source[4:]
     p = source.find('(')

Modified: pypy/trunk/pypy/objspace/test/test_descriptor.py
==============================================================================
--- pypy/trunk/pypy/objspace/test/test_descriptor.py	(original)
+++ pypy/trunk/pypy/objspace/test/test_descriptor.py	Thu Jan 21 18:36:53 2010
@@ -1,3 +1,4 @@
+import py
 from pypy.conftest import gettestobjspace
 
 class AppTest_Descriptor:
@@ -36,6 +37,7 @@
         x.a = 42
         assert x.a == 42
 
+    @py.test.mark.xfail
     def test_failing_get(self):
         # when __get__() raises AttributeError,
         # __getattr__ is called...



More information about the Pypy-commit mailing list