Author: Amaury Forgeot d'Arc <[email protected]>
Branch: less-gettestobjspace
Changeset: r58615:ea2d5e2470cf
Date: 2012-10-29 00:28 +0100
http://bitbucket.org/pypy/pypy/changeset/ea2d5e2470cf/
Log: progress
diff --git a/pypy/module/__pypy__/test/test_builders.py
b/pypy/module/__pypy__/test/test_builders.py
--- a/pypy/module/__pypy__/test/test_builders.py
+++ b/pypy/module/__pypy__/test/test_builders.py
@@ -1,9 +1,5 @@
-from pypy.conftest import gettestobjspace
-
-
class AppTestBuilders(object):
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['__pypy__'])
+ spaceconfig = dict(usemodules=['__pypy__'])
def test_simple(self):
from __pypy__.builders import UnicodeBuilder
diff --git a/pypy/module/__pypy__/test/test_bytebuffer.py
b/pypy/module/__pypy__/test/test_bytebuffer.py
--- a/pypy/module/__pypy__/test/test_bytebuffer.py
+++ b/pypy/module/__pypy__/test/test_bytebuffer.py
@@ -1,9 +1,5 @@
-import py
-from pypy.conftest import gettestobjspace
-
class AppTest(object):
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['__pypy__'])
+ spaceconfig = dict(usemodules=['__pypy__'])
def test_bytebuffer(self):
from __pypy__ import bytebuffer
diff --git a/pypy/module/__pypy__/test/test_debug.py
b/pypy/module/__pypy__/test/test_debug.py
--- a/pypy/module/__pypy__/test/test_debug.py
+++ b/pypy/module/__pypy__/test/test_debug.py
@@ -1,13 +1,12 @@
import py
-from pypy.conftest import gettestobjspace, option
from pypy.rlib import debug
class AppTestDebug:
+ spaceconfig = dict(usemodules=['__pypy__'])
+
def setup_class(cls):
- if option.runappdirect:
+ if cls.option.runappdirect:
py.test.skip("not meant to be run with -A")
- cls.space = gettestobjspace(usemodules=['__pypy__'])
- space = cls.space
cls.w_check_log = cls.space.wrap(cls.check_log)
def setup_method(self, meth):
diff --git a/pypy/module/__pypy__/test/test_identitydict.py
b/pypy/module/__pypy__/test/test_identitydict.py
--- a/pypy/module/__pypy__/test/test_identitydict.py
+++ b/pypy/module/__pypy__/test/test_identitydict.py
@@ -1,9 +1,5 @@
-import py
-from pypy.conftest import gettestobjspace
-
class AppTestIdentityDict:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['__pypy__'])
+ spaceconfig = dict(usemodules=['__pypy__'])
def test_numbers(self):
from __pypy__ import identity_dict
diff --git a/pypy/module/__pypy__/test/test_special.py
b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -1,11 +1,12 @@
import py
-from pypy.conftest import gettestobjspace, option
class AppTest(object):
+ spaceconfig = {"objspace.usemodules.select": False,
+ "objspace.std.withrangelist": True}
+
def setup_class(cls):
- if option.runappdirect:
+ if cls.option.runappdirect:
py.test.skip("does not make sense on pypy-c")
- cls.space = gettestobjspace(**{"objspace.usemodules.select": False,
"objspace.std.withrangelist": True})
def test__isfake(self):
from __pypy__ import isfake
diff --git a/pypy/module/parser/test/test_parser.py
b/pypy/module/parser/test/test_parser.py
--- a/pypy/module/parser/test/test_parser.py
+++ b/pypy/module/parser/test/test_parser.py
@@ -1,16 +1,11 @@
-from pypy.conftest import gettestobjspace
-
-def setup_module(mod):
- mod.space = gettestobjspace(usemodules=["parser"])
-
class ParserModuleTest:
+ spaceconfig = dict(usemodules=["parser"])
def setup_class(cls):
- cls.space = space
- cls.w_m = space.appexec([], """():
+ cls.w_m = cls.space.appexec([], """():
import parser
return parser""")
- cls.w_symbol = space.appexec([], """():
+ cls.w_symbol = cls.space.appexec([], """():
import symbol
return symbol""")
diff --git a/pypy/module/posix/test/test_posix_libfile.py
b/pypy/module/posix/test/test_posix_libfile.py
--- a/pypy/module/posix/test/test_posix_libfile.py
+++ b/pypy/module/posix/test/test_posix_libfile.py
@@ -1,17 +1,17 @@
-from pypy.conftest import gettestobjspace
from pypy.tool.udir import udir
import os
def setup_module(mod):
- mod.space = gettestobjspace(usemodules=['posix'])
mod.path = udir.join('posixtestfile.txt')
mod.path.write("this is a test")
class AppTestPosix:
+ spaceconfig = dict(usemodules=['posix'])
+
def setup_class(cls):
- cls.space = space
- cls.w_posix = space.appexec([], "(): import %s as m ; return m" %
os.name)
- cls.w_path = space.wrap(str(path))
+ cls.w_posix = cls.space.appexec([], """():
+ import %s as m ; return m""" % os.name)
+ cls.w_path = cls.space.wrap(str(path))
def test_posix_is_pypy_s(self):
assert self.posix.__file__
diff --git a/pypy/module/pwd/test/test_pwd.py b/pypy/module/pwd/test/test_pwd.py
--- a/pypy/module/pwd/test/test_pwd.py
+++ b/pypy/module/pwd/test/test_pwd.py
@@ -1,8 +1,5 @@
-from pypy.conftest import gettestobjspace
-
class AppTestPwd:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['pwd'])
+ spaceconfig = dict(usemodules=['pwd'])
def test_getpwuid(self):
import pwd, sys
diff --git a/pypy/module/pyexpat/test/test_parser.py
b/pypy/module/pyexpat/test/test_parser.py
--- a/pypy/module/pyexpat/test/test_parser.py
+++ b/pypy/module/pyexpat/test/test_parser.py
@@ -1,10 +1,8 @@
-from pypy.conftest import gettestobjspace
from pypy.module.pyexpat.interp_pyexpat import global_storage
from pytest import skip
class AppTestPyexpat:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['pyexpat'])
+ spaceconfig = dict(usemodules=['pyexpat'])
def teardown_class(cls):
global_storage.clear()
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py
b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -1,6 +1,5 @@
import py
-from pypy.conftest import gettestobjspace, option
from pypy.interpreter.gateway import interp2app
from pypy.interpreter.pycode import PyCode
from pypy.jit.metainterp.history import JitCellToken, ConstInt, ConstPtr
@@ -35,12 +34,11 @@
jitdrivers_sd = [MockJitDriverSD]
class AppTestJitHook(object):
+ spaceconfig = dict(usemodules=('pypyjit',))
def setup_class(cls):
- if option.runappdirect:
+ if cls.option.runappdirect:
py.test.skip("Can't run this test with -A")
- space = gettestobjspace(usemodules=('pypyjit',))
- cls.space = space
- w_f = space.appexec([], """():
+ w_f = cls.space.appexec([], """():
def function():
pass
return function
@@ -89,6 +87,7 @@
pypy_hooks.on_abort(Counters.ABORT_TOO_LONG, pypyjitdriver,
greenkey, 'blah')
+ space = cls.space
cls.w_on_compile = space.wrap(interp2app(interp_on_compile))
cls.w_on_compile_bridge =
space.wrap(interp2app(interp_on_compile_bridge))
cls.w_on_abort = space.wrap(interp2app(interp_on_abort))
diff --git a/pypy/module/pypyjit/test/test_jit_setup.py
b/pypy/module/pypyjit/test/test_jit_setup.py
--- a/pypy/module/pypyjit/test/test_jit_setup.py
+++ b/pypy/module/pypyjit/test/test_jit_setup.py
@@ -1,9 +1,5 @@
-from pypy.conftest import gettestobjspace
-
class AppTestPyPyJIT:
- def setup_class(cls):
- space = gettestobjspace(usemodules=('pypyjit',))
- cls.space = space
+ spaceconfig = dict(usemodules=('pypyjit',))
def test_setup(self):
# this just checks that the module is setting up things correctly, and
@@ -51,13 +47,9 @@
assert type(d) is dict
assert 'threshold' in d
-
-def test_interface_residual_call():
- space = gettestobjspace(usemodules=['pypyjit'])
- space.appexec([], """():
+ def test_interface_residual_call(self):
import pypyjit
def f(*args, **kwds):
return (args, kwds)
res = pypyjit.residual_call(f, 4, x=6)
assert res == ((4,), {'x': 6})
- """)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit