[pypy-svn] r7264 - pypy/trunk/src/pypy/interpreter/test
hpk at codespeak.net
hpk at codespeak.net
Tue Nov 16 10:47:46 CET 2004
Author: hpk
Date: Tue Nov 16 10:47:46 2004
New Revision: 7264
Modified:
pypy/trunk/src/pypy/interpreter/test/test_main.py
Log:
avoid using yet another class from CPython (StringIO)
and just use a file (which we have to "fake" anyway)
Modified: pypy/trunk/src/pypy/interpreter/test/test_main.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/test/test_main.py (original)
+++ pypy/trunk/src/pypy/interpreter/test/test_main.py Tue Nov 16 10:47:46 2004
@@ -1,6 +1,7 @@
import unittest
import autopath
from cStringIO import StringIO
+from pypy.tool.udir import udir
from pypy.tool import testit
from pypy.interpreter.baseobjspace import OperationError
@@ -17,20 +18,20 @@
testresultoutput = '11\n'
-capture = StringIO()
def checkoutput(expected_output,f,*args):
space = testit.objspace()
w_sys = space.get_builtin_module("sys")
w_oldout = space.getattr(w_sys, space.wrap("stdout"))
- capture.reset()
- space.setattr(w_sys, space.wrap("stdout"), space.wrap(capture))
+ capturefn = udir.join('capturefile')
+ capturefile = capturefn.open('w')
+ space.setattr(w_sys, space.wrap("stdout"), space.wrap(capturefile))
try:
f(*(args + (space,)))
finally:
space.setattr(w_sys, space.wrap("stdout"), w_oldout)
-
- return capture.getvalue() == expected_output
+ capturefile.close()
+ return capturefn.read() == expected_output
testfn = 'tmp_hello_world.py'
More information about the Pypy-commit
mailing list