[pypy-svn] r7265 - in pypy/trunk/src: goal pypy/module/test
hpk at codespeak.net
hpk at codespeak.net
Tue Nov 16 10:49:31 CET 2004
Author: hpk
Date: Tue Nov 16 10:49:31 2004
New Revision: 7265
Modified:
pypy/trunk/src/goal/testcachebuild.py
pypy/trunk/src/pypy/module/test/test_import.py
Log:
trigger building the caches with some (somewhat random)
application code
fixed the test_import to use temporary gateways (that
don't participate in the space's cache)
Modified: pypy/trunk/src/goal/testcachebuild.py
==============================================================================
--- pypy/trunk/src/goal/testcachebuild.py (original)
+++ pypy/trunk/src/goal/testcachebuild.py Tue Nov 16 10:49:31 2004
@@ -1,28 +1,57 @@
from pypy.tool import option, autopath, testit
from pypy.interpreter import gateway
from pypy.tool.frozendict import frozendict
+import os
#######################################################
-def app_triggergenerator():
+def app_triggerall():
+ import sys, types # , exceptions
+ k = 42
def gen():
- yield 42
+ yield k
+ #yield (k, 1.0, 4L, [''], {}, unicode, Ellipsis)
+ try:
+ raise ValueError
+ except ValueError:
+ x = sys.exc_info()
+ try:
+ raise x[0], x[1], x[2]
+ except ValueError:
+ pass
+
+ gen.func_code.co_name
+ str({'co_name': ('f',)}), str(object.__init__.im_func.func_code)
+ "for %r" % ({'x': gen})
+ ("%02d"%1)
+ ("%05d"%1)
+ ("%-05d"%1)
+ ("%04f"%2.25)
+ ("%05g"%2.25)
+ ("%-05g"%2.25)
+ ("%05s"%2.25)
+ ('<%s>' % [1,2])
+ ('<%s-%s>' % ([1,2], [3,4]))
+
for x in gen():
pass
+
+def app_triggerexec():
+ exec "i=3"
gateway.importall(globals()) # app_xxx() -> xxx()
#######################################################
def triggercachebuild(space):
- triggergenerator(space)
+ triggerall(space)
+ triggerexec(space)
if __name__ == '__main__':
space = option.objspace('std')
- #triggercachebuild(space)
- testit.main(autopath.pypydir)
-
+ triggercachebuild(space)
+ #testit.main(autopath.pypydir)
space._typecache = frozendict(space._typecache)
space._faketypecache = frozendict(space._faketypecache)
space._gatewaycache = frozendict(space._gatewaycache)
- testit.main(autopath.pypydir)
+ testit.main(os.path.join(autopath.pypydir)) # , 'objspace', 'std'))
Modified: pypy/trunk/src/pypy/module/test/test_import.py
==============================================================================
--- pypy/trunk/src/pypy/module/test/test_import.py (original)
+++ pypy/trunk/src/pypy/module/test/test_import.py Tue Nov 16 10:49:31 2004
@@ -9,7 +9,7 @@
sys.path.append(dn)
return sys.modules.copy()
-_setup = gateway.app2interp(_setup,'setup')
+_setup = gateway.app2interp_temp(_setup,'setup')
def _teardown(saved_modules):
import sys
@@ -17,7 +17,7 @@
sys.modules.clear()
sys.modules.update(saved_modules)
-_teardown = gateway.app2interp(_teardown,'teardown')
+_teardown = gateway.app2interp_temp(_teardown,'teardown')
class TestImport(testit.AppTestCase):
More information about the Pypy-commit
mailing list