This does not yet fix bin/test to use py.test if available.
There is one raises() test failing, but I don't know why.

Signed-off-by: Vinzent Steinberg <vinzent.steinb...@gmail.com>
---
 sympy/utilities/pytest.py |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/sympy/utilities/pytest.py b/sympy/utilities/pytest.py
index 25ed9f7..ad5f28e 100644
--- a/sympy/utilities/pytest.py
+++ b/sympy/utilities/pytest.py
@@ -6,23 +6,13 @@
 import sys
 
 try:
-    # tested with py-lib 0.9.0
-    from py.__.test.outcome import Outcome, Passed, Failed, Skipped
-    from py.__.test.terminal.terminal import TerminalSession
-    from py.test import skip
+    # tested with py-lib 1.2.1
+    import py.test
     USE_PYTEST = True
 except ImportError:
     USE_PYTEST = False
 
-def raises(ExpectedException, code):
-    assert isinstance(code, str)
-    frame = sys._getframe(1)
-    loc = frame.f_locals.copy()
-    try:
-        exec code in frame.f_globals, loc
-    except ExpectedException:
-        return
-    raise AssertionError("DID NOT RAISE")
+print 'USE_PYTEST', USE_PYTEST
 
 if not USE_PYTEST:
     class XFail(Exception):
@@ -45,10 +35,21 @@ def wrapper():
 
     def skip(str):
         raise Skipped(str)
-else:
-    from time import time as now
 
+    def raises(ExpectedException, code):
+        assert isinstance(code, str)
+        frame = sys._getframe(1)
+        loc = frame.f_locals.copy()
+        try:
+            exec code in frame.f_globals, loc
+        except ExpectedException:
+            return
+        raise AssertionError("DID NOT RAISE")
+
+else:
     __all__ = ['XFAIL']
+    '''
+    from time import time as now
 
     class XFail(Outcome):
         pass
@@ -128,3 +129,9 @@ def func_wrapper():
                 raise XPass('XPASS: %s' % func.func_name)
 
         return func_wrapper
+    '''
+    def XFAIL(func):
+        return py.test.mark.xfail(func)
+    skip = py.test.skip
+    raises = py.test.raises
+
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patc...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en.

Reply via email to