[pypy-commit] pypy less-gettestobjspace: progress
amauryfa
noreply at buildbot.pypy.org
Mon Oct 29 22:40:15 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: less-gettestobjspace
Changeset: r58612:6ad9b5cdd6f4
Date: 2012-10-29 00:00 +0100
http://bitbucket.org/pypy/pypy/changeset/6ad9b5cdd6f4/
Log: progress
diff --git a/pypy/module/_io/test/test_bufferedio.py b/pypy/module/_io/test/test_bufferedio.py
--- a/pypy/module/_io/test/test_bufferedio.py
+++ b/pypy/module/_io/test/test_bufferedio.py
@@ -1,5 +1,4 @@
from __future__ import with_statement
-from pypy.conftest import gettestobjspace, option
from pypy.interpreter.gateway import interp2app
from pypy.tool.udir import udir
from pypy.module._io import interp_bufferedio
@@ -220,11 +219,12 @@
class AppTestBufferedWriter:
+ spaceconfig = dict(usemodules=['_io', 'thread'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io', 'thread'])
tmpfile = udir.join('tmpfile')
cls.w_tmpfile = cls.space.wrap(str(tmpfile))
- if option.runappdirect:
+ if cls.option.runappdirect:
cls.w_readfile = tmpfile.read
else:
def readfile(space):
@@ -541,8 +541,9 @@
raises(IOError, _io.BufferedRWPair, _io.BytesIO(), NotWritable())
class AppTestBufferedRandom:
+ spaceconfig = dict(usemodules=['_io'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io'])
tmpfile = udir.join('tmpfile')
tmpfile.write("a\nb\nc", mode='wb')
cls.w_tmpfile = cls.space.wrap(str(tmpfile))
@@ -623,8 +624,9 @@
assert raw.getvalue() == b'1b\n2def\n3\n'
class TestNonReentrantLock:
- def test_trylock(self):
- space = gettestobjspace(usemodules=['thread'])
+ spaceconfig = dict(usemodules=['thread'])
+
+ def test_trylock(self, space):
lock = interp_bufferedio.TryLock(space)
with lock:
pass
diff --git a/pypy/module/_io/test/test_bytesio.py b/pypy/module/_io/test/test_bytesio.py
--- a/pypy/module/_io/test/test_bytesio.py
+++ b/pypy/module/_io/test/test_bytesio.py
@@ -1,8 +1,5 @@
-from pypy.conftest import gettestobjspace
-
class AppTestBytesIO:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io'])
+ spaceconfig = dict(usemodules=['_io'])
def test_init(self):
import _io
diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -1,10 +1,10 @@
-from pypy.conftest import gettestobjspace
from pypy.tool.udir import udir
import os
class AppTestFileIO:
+ spaceconfig = dict(usemodules=['_io'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io'])
tmpfile = udir.join('tmpfile')
tmpfile.write("a\nb\nc", mode='wb')
cls.w_tmpfile = cls.space.wrap(str(tmpfile))
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -1,13 +1,11 @@
from __future__ import with_statement
-from pypy.conftest import gettestobjspace
from pypy.tool.udir import udir
class AppTestIoModule:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io'])
-
+ spaceconfig = dict(usemodules=['_io'])
+xo
def test_import(self):
import io
@@ -157,8 +155,9 @@
assert s is None
class AppTestOpen:
+ spaceconfig = dict(usemodules=['_io', '_locale', 'array', 'struct'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io', '_locale', 'array', 'struct'])
tmpfile = udir.join('tmpfile').ensure()
cls.w_tmpfile = cls.space.wrap(str(tmpfile))
diff --git a/pypy/module/_io/test/test_textio.py b/pypy/module/_io/test/test_textio.py
--- a/pypy/module/_io/test/test_textio.py
+++ b/pypy/module/_io/test/test_textio.py
@@ -1,8 +1,5 @@
-from pypy.conftest import gettestobjspace
-
class AppTestTextIO:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['_io', '_locale'])
+ spaceconfig = dict(usemodules=['_io', '_locale'])
def test_constructor(self):
import _io
diff --git a/pypy/module/_locale/test/test_locale.py b/pypy/module/_locale/test/test_locale.py
--- a/pypy/module/_locale/test/test_locale.py
+++ b/pypy/module/_locale/test/test_locale.py
@@ -1,12 +1,11 @@
import py
-from pypy.conftest import gettestobjspace
import sys
class AppTestLocaleTrivia:
+ spaceconfig = dict(usemodules=['_locale', 'unicodedata'])
+
def setup_class(cls):
- cls.space = space = gettestobjspace(usemodules=['_locale',
- 'unicodedata'])
if sys.platform != 'win32':
cls.w_language_en = cls.space.wrap("C")
cls.w_language_utf8 = cls.space.wrap("en_US.utf8")
@@ -26,21 +25,21 @@
# some systems are only UTF-8 oriented
try:
_locale.setlocale(_locale.LC_ALL,
- space.str_w(cls.w_language_en))
+ cls.space.str_w(cls.w_language_en))
except _locale.Error:
_locale.setlocale(_locale.LC_ALL,
- space.str_w(cls.w_language_utf8))
+ cls.space.str_w(cls.w_language_utf8))
cls.w_language_en = cls.w_language_utf8
_locale.setlocale(_locale.LC_ALL,
- space.str_w(cls.w_language_pl))
+ cls.space.str_w(cls.w_language_pl))
except _locale.Error:
py.test.skip("necessary locales not installed")
# Windows forbids the UTF-8 character set since Windows XP.
try:
_locale.setlocale(_locale.LC_ALL,
- space.str_w(cls.w_language_utf8))
+ cls.space.str_w(cls.w_language_utf8))
except _locale.Error:
del cls.w_language_utf8
finally:
diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -1,14 +1,9 @@
-import py
-from pypy.conftest import gettestobjspace, option
-
class AppTestCProfile(object):
- keywords = {}
+ spaceconfig = dict(usemodules=('_lsprof',))
def setup_class(cls):
- space = gettestobjspace(usemodules=('_lsprof',), **cls.keywords)
- cls.w_expected_output = space.wrap(expected_output)
- cls.space = space
- cls.w_file = space.wrap(__file__)
+ cls.w_expected_output = cls.space.wrap(expected_output)
+ cls.w_file = cls.space.wrap(__file__)
def test_repr(self):
import _lsprof
@@ -195,7 +190,8 @@
class AppTestWithDifferentBytecodes(AppTestCProfile):
- keywords = {'objspace.opcodes.CALL_METHOD': True}
+ spaceconfig = AppTestCProfile.spaceconfig.copy()
+ spaceconfig['objspace.opcodes.CALL_METHOD'] = True
expected_output = {}
diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -5,7 +5,7 @@
import pypy.interpreter.pycode
from pypy.tool.udir import udir
from pypy.rlib import streamio
-from pypy.conftest import gettestobjspace
+from pypy.tool.option import make_config, make_objspace
import pytest
import sys, os
import tempfile, marshal
@@ -146,9 +146,9 @@
""")
class AppTestImport:
+ spaceconfig = dict(usemodules=['itertools'])
def setup_class(cls): # interpreter-level
- cls.space = gettestobjspace(usemodules=['itertools'])
cls.w_runappdirect = cls.space.wrap(conftest.option.runappdirect)
cls.saved_modules = _setup(cls.space)
#XXX Compile class
@@ -642,8 +642,8 @@
class TestAbi:
def test_abi_tag(self):
- space1 = gettestobjspace(soabi='TEST')
- space2 = gettestobjspace(soabi='')
+ space1 = make_objspace(make_config(None, soabi='TEST'))
+ space2 = make_objspace(make_config(None, soabi=''))
if sys.platform == 'win32':
assert importing.get_so_extension(space1) == '.TESTi.pyd'
assert importing.get_so_extension(space2) == '.pyd'
@@ -953,7 +953,7 @@
allspaces = [self.space]
for opcodename in self.space.config.objspace.opcodes.getpaths():
key = 'objspace.opcodes.' + opcodename
- space2 = gettestobjspace(**{key: True})
+ space2 = make_objspace(make_config(None, **{key: True}))
allspaces.append(space2)
for space1 in allspaces:
for space2 in allspaces:
@@ -1003,12 +1003,12 @@
os.environ['LANG'] = oldlang
class AppTestImportHooks(object):
+ spaceconfig = dict(usemodules=('struct',))
def setup_class(cls):
- space = cls.space = gettestobjspace(usemodules=('struct',))
mydir = os.path.dirname(__file__)
- cls.w_hooktest = space.wrap(os.path.join(mydir, 'hooktest'))
- space.appexec([space.wrap(mydir)], """
+ cls.w_hooktest = cls.space.wrap(os.path.join(mydir, 'hooktest'))
+ cls.space.appexec([cls.space.wrap(mydir)], """
(mydir):
import sys
sys.path.append(mydir)
@@ -1176,9 +1176,9 @@
sys.path_hooks.pop()
class AppTestPyPyExtension(object):
+ spaceconfig = dict(usemodules=['imp', 'zipimport', '__pypy__'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['imp', 'zipimport',
- '__pypy__'])
cls.w_udir = cls.space.wrap(str(udir))
def test_run_compiled_module(self):
@@ -1262,10 +1262,11 @@
class AppTestMultithreadedImp(object):
+ spaceconfig = dict(usemodules=['thread', 'time'])
+
def setup_class(cls):
#if not conftest.option.runappdirect:
# py.test.skip("meant as an -A test")
- cls.space = gettestobjspace(usemodules=['thread', 'time'])
tmpfile = udir.join('test_multithreaded_imp.py')
tmpfile.write('''if 1:
x = 666
diff --git a/pypy/module/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
--- a/pypy/module/itertools/test/test_itertools.py
+++ b/pypy/module/itertools/test/test_itertools.py
@@ -1,10 +1,8 @@
import py
-from pypy.conftest import gettestobjspace
class AppTestItertools:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['itertools'])
+ spaceconfig = dict(usemodules=['itertools'])
def test_count(self):
import itertools
@@ -678,8 +676,9 @@
class AppTestItertools26:
+ spaceconfig = dict(usemodules=['itertools'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['itertools'])
if cls.space.is_true(cls.space.appexec([], """():
import sys; return sys.version_info < (2, 6)
""")):
@@ -909,8 +908,9 @@
class AppTestItertools27:
+ spaceconfig = dict(usemodules=['itertools', 'struct'])
+
def setup_class(cls):
- cls.space = gettestobjspace(usemodules=['itertools', 'struct'])
if cls.space.is_true(cls.space.appexec([], """():
import sys; return sys.version_info < (2, 7)
""")):
More information about the pypy-commit
mailing list