[pypy-commit] pypy less-gettestobjspace: progress
amauryfa
noreply at buildbot.pypy.org
Mon Oct 29 22:40:13 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: less-gettestobjspace
Changeset: r58611:4c08ac55ba7d
Date: 2012-10-28 23:30 +0100
http://bitbucket.org/pypy/pypy/changeset/4c08ac55ba7d/
Log: progress
diff --git a/pypy/module/_ffi/test/test_funcptr.py b/pypy/module/_ffi/test/test_funcptr.py
--- a/pypy/module/_ffi/test/test_funcptr.py
+++ b/pypy/module/_ffi/test/test_funcptr.py
@@ -1,4 +1,3 @@
-from pypy.conftest import gettestobjspace
from pypy.rpython.lltypesystem import rffi
from pypy.rlib.clibffi import get_libc_name
from pypy.rlib.libffi import types
@@ -8,6 +7,7 @@
import sys, py
class BaseAppTestFFI(object):
+ spaceconfig = dict(usemodules=('_ffi', '_rawffi'))
@classmethod
def prepare_c_example(cls):
@@ -37,8 +37,7 @@
return str(platform.compile([c_file], eci, 'x', standalone=False))
def setup_class(cls):
- space = gettestobjspace(usemodules=('_ffi', '_rawffi'))
- cls.space = space
+ space = cls.space
cls.w_iswin32 = space.wrap(sys.platform == 'win32')
cls.w_libfoo_name = space.wrap(cls.prepare_c_example())
cls.w_libc_name = space.wrap(get_libc_name())
diff --git a/pypy/module/_ffi/test/test_struct.py b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -1,5 +1,4 @@
import sys
-from pypy.conftest import gettestobjspace, option
from pypy.module._ffi.test.test_funcptr import BaseAppTestFFI
from pypy.module._ffi.interp_struct import compute_size_and_alignement, W_Field
from pypy.module._ffi.interp_ffitype import app_types, W_FFIType
@@ -62,7 +61,7 @@
dummy_type.c_alignment = rffi.cast(rffi.USHORT, 0)
dummy_type.c_type = rffi.cast(rffi.USHORT, 0)
cls.w_dummy_type = W_FFIType('dummy', dummy_type)
- cls.w_runappdirect = cls.space.wrap(option.runappdirect)
+ cls.w_runappdirect = cls.space.wrap(cls.option.runappdirect)
def test__StructDescr(self):
from _ffi import _StructDescr, Field, types
diff --git a/pypy/module/_ffi/test/test_type_converter.py b/pypy/module/_ffi/test/test_type_converter.py
--- a/pypy/module/_ffi/test/test_type_converter.py
+++ b/pypy/module/_ffi/test/test_type_converter.py
@@ -1,5 +1,4 @@
import sys
-from pypy.conftest import gettestobjspace
from pypy.rlib.rarithmetic import r_uint, r_singlefloat, r_longlong, r_ulonglong
from pypy.rlib.libffi import IS_32_BIT
from pypy.module._ffi.interp_ffitype import app_types, descr_new_pointer
@@ -30,9 +29,9 @@
class TestFromAppLevel(object):
+ spaceconfig = dict(usemodules=('_ffi',))
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=('_ffi',))
converter = DummyFromAppLevelConverter(cls.space)
cls.from_app_level = staticmethod(converter.convert)
@@ -152,9 +151,9 @@
class TestFromAppLevel(object):
+ spaceconfig = dict(usemodules=('_ffi',))
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=('_ffi',))
converter = DummyToAppLevelConverter(cls.space)
cls.from_app_level = staticmethod(converter.convert)
diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -1,8 +1,6 @@
from __future__ import with_statement
import py, os, errno
-from pypy.conftest import gettestobjspace, option
-
def getfile(space):
return space.appexec([], """():
try:
@@ -13,8 +11,9 @@
""")
class AppTestFile(object):
+ spaceconfig = dict(usemodules=("_file",))
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=("_file", ))
cls.w_temppath = cls.space.wrap(
str(py.test.ensuretemp("fileimpl").join("foo.txt")))
cls.w_file = getfile(cls.space)
@@ -263,7 +262,7 @@
cls.old_read = os.read
- if option.runappdirect:
+ if cls.option.runappdirect:
py.test.skip("works with internals of _file impl on py.py")
state = [0]
def read(fd, n=None):
@@ -293,10 +292,11 @@
# these tests only really make sense on top of a translated pypy-c,
# because on top of py.py the inner calls to os.write() don't
# release our object space's GIL.
+ spaceconfig = dict(usemodules=("_file",))
+
def setup_class(cls):
- if not option.runappdirect:
+ if not cls.option.runappdirect:
py.test.skip("likely to deadlock when interpreted by py.py")
- cls.space = gettestobjspace(usemodules=("_file", "thread"))
cls.w_temppath = cls.space.wrap(
str(py.test.ensuretemp("fileimpl").join("concurrency.txt")))
cls.w_file = getfile(cls.space)
@@ -387,8 +387,9 @@
class AppTestFile25:
+ spaceconfig = dict(usemodules=("_file",))
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=("_file", ))
cls.w_temppath = cls.space.wrap(
str(py.test.ensuretemp("fileimpl").join("foo.txt")))
cls.w_file = getfile(cls.space)
diff --git a/pypy/module/_file/test/test_file_extra.py b/pypy/module/_file/test/test_file_extra.py
--- a/pypy/module/_file/test/test_file_extra.py
+++ b/pypy/module/_file/test/test_file_extra.py
@@ -1,7 +1,6 @@
import os, random, sys
import pypy.tool.udir
import py
-from pypy.conftest import gettestobjspace
udir = pypy.tool.udir.udir.ensure('test_file_extra', dir=1)
@@ -352,10 +351,7 @@
# A few extra tests
class AppTestAFewExtra:
-
- def setup_class(cls):
- space = gettestobjspace(usemodules=('array',))
- cls.space = space
+ spaceconfig = dict(usemodules=('_ffi',))
def setup_method(self, method):
fn = str(udir.join('temptestfile'))
diff --git a/pypy/module/_file/test/test_large_file.py b/pypy/module/_file/test/test_large_file.py
--- a/pypy/module/_file/test/test_large_file.py
+++ b/pypy/module/_file/test/test_large_file.py
@@ -1,11 +1,11 @@
import py
-from pypy.conftest import gettestobjspace
from pypy.module._file.test.test_file import getfile
class AppTestLargeFile(object):
+ spaceconfig = dict(usemodules=("_file",))
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=("_file", ))
cls.w_temppath = cls.space.wrap(
str(py.test.ensuretemp("fileimpl").join("large.data")))
cls.w_file = getfile(cls.space)
diff --git a/pypy/module/_hashlib/test/test_hashlib.py b/pypy/module/_hashlib/test/test_hashlib.py
--- a/pypy/module/_hashlib/test/test_hashlib.py
+++ b/pypy/module/_hashlib/test/test_hashlib.py
@@ -1,9 +1,7 @@
import py
-from pypy.conftest import gettestobjspace
class AppTestHashlib:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_hashlib', 'array', 'struct'])
+ spaceconfig = dict(usemodules=['_hashlib', 'array', 'struct'])
def test_simple(self):
import _hashlib
diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -1,4 +1,3 @@
-from pypy.conftest import gettestobjspace
import os
from pypy.tool.udir import udir
@@ -12,11 +11,10 @@
os.unlink(i)
class AppTestFcntl:
+ spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios'))
def setup_class(cls):
- space = gettestobjspace(usemodules=('fcntl', 'array', 'struct', 'termios'))
- cls.space = space
tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_'))
- cls.w_tmp = space.wrap(tmpprefix)
+ cls.w_tmp = cls.space.wrap(tmpprefix)
def test_fcntl(self):
import fcntl
diff --git a/pypy/module/gc/test/test_gc.py b/pypy/module/gc/test/test_gc.py
--- a/pypy/module/gc/test/test_gc.py
+++ b/pypy/module/gc/test/test_gc.py
@@ -1,4 +1,3 @@
-from pypy.conftest import gettestobjspace
import py
class AppTestGC(object):
@@ -88,7 +87,6 @@
cls._heap_stats = rgc._heap_stats
rgc._heap_stats = fake_heap_stats
fname = udir.join('gcdump.log')
- cls.space = gettestobjspace()
cls.w_fname = cls.space.wrap(str(fname))
cls._fname = fname
@@ -105,8 +103,7 @@
class AppTestGcMethodCache(object):
- def setup_class(cls):
- cls.space = gettestobjspace(**{"objspace.std.withmethodcache": True})
+ spaceconfig = {"objspace.std.withmethodcache": True}
def test_clear_method_cache(self):
import gc, weakref
@@ -127,10 +124,8 @@
assert r() is None
class AppTestGcMapDictIndexCache(AppTestGcMethodCache):
- def setup_class(cls):
- cls.space = gettestobjspace(**{"objspace.std.withmethodcache": True,
- "objspace.std.withmapdict": True})
-
+ spaceconfig = {"objspace.std.withmethodcache": True,
+ "objspace.std.withmapdict": True}
def test_clear_index_cache(self):
import gc, weakref
More information about the pypy-commit
mailing list