[pypy-svn] r7297 - in pypy/trunk/src/pypy/tool: . pytest testdata
hpk at codespeak.net
hpk at codespeak.net
Tue Nov 16 17:40:38 CET 2004
Author: hpk
Date: Tue Nov 16 17:40:37 2004
New Revision: 7297
Added:
pypy/trunk/src/pypy/tool/pytest/
pypy/trunk/src/pypy/tool/pytest/support.py
- copied, changed from r7287, pypy/trunk/src/pypy/tool/pypyutest.py
Removed:
pypy/trunk/src/pypy/tool/pypyutest.py
pypy/trunk/src/pypy/tool/testdata/
Log:
- remove 'testdata' (only used by the old newtest.py which
also got removed)
- the beginnings of some support for conversion to using py.test
(currently found in pypy/tool/pytest/support.py)
Deleted: /pypy/trunk/src/pypy/tool/pypyutest.py
==============================================================================
--- /pypy/trunk/src/pypy/tool/pypyutest.py Tue Nov 16 17:40:37 2004
+++ (empty file)
@@ -1,41 +0,0 @@
-from py.__impl__.magic import exprinfo
-import py
-py.magic.autopath()
-from pypy.objspace.std import StdObjSpace
-
-class AppRunnerFrame:
-
- def __init__(self, space, w_globals, w_locals):
- self.space = space
- self.w_globals = w_globals
- self.w_locals = w_locals
-
- def eval(self, code, **vars):
- space = self.space
- for key, w_value in vars.items():
- space.setitem(self.w_locals, space.wrap(key), w_value)
- return space.eval(code, self.w_globals, self.w_locals)
-
- def exec_(self, code, **vars):
- space = self.space
- for key, w_value in vars.items():
- space.setitem(self.w_locals, space.wrap(key), w_value)
- space.exec_(code, self.w_globals, self.w_locals)
-
- def repr(self, w_value):
- return self.space.unwrap(self.space.repr(w_value))
-
- def is_true(self, w_value):
- return self.space.is_true(w_value)
-
-
-def test():
- space = StdObjSpace()
- w_glob = space.newdict([])
- w_loc = space.newdict([])
- runner = AppRunnerFrame(space, w_glob, w_loc)
- exprinfo.run("f = lambda x: x+1", runner)
- exprinfo.check("isinstance(f(2), float)", runner)
-
-if __name__ == '__main__':
- test()
Copied: pypy/trunk/src/pypy/tool/pytest/support.py (from r7287, pypy/trunk/src/pypy/tool/pypyutest.py)
==============================================================================
--- pypy/trunk/src/pypy/tool/pypyutest.py (original)
+++ pypy/trunk/src/pypy/tool/pytest/support.py Tue Nov 16 17:40:37 2004
@@ -2,6 +2,7 @@
import py
py.magic.autopath()
from pypy.objspace.std import StdObjSpace
+from pypy.interpreter.gateway import app2interp, interp2app
class AppRunnerFrame:
@@ -28,6 +29,26 @@
def is_true(self, w_value):
return self.space.is_true(w_value)
+def build_pytest_assertion(space):
+ def app_getmyassertion():
+ class MyAssertionError(AssertionError):
+ def __init__(self, *args):
+ AssertionError.__init__(self, *args)
+ self.inspect_assertion()
+ return MyAssertionError
+ getmyassertion = app2interp(app_getmyassertion)
+ w_myassertion = getmyassertion(space)
+
+ def inspect_assertion(space, w_self):
+ pass
+ #print w_self
+ #print "got to interp-level inspect_assertion"
+
+ w_inspect_assertion = space.wrap(interp2app(inspect_assertion))
+ space.setattr(w_myassertion,
+ space.wrap('inspect_assertion'),
+ w_inspect_assertion)
+ return w_myassertion
def test():
space = StdObjSpace()
More information about the Pypy-commit
mailing list