[pypy-commit] pypy less-gettestobjspace: progress
amauryfa
noreply at buildbot.pypy.org
Mon Oct 29 22:40:20 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: less-gettestobjspace
Changeset: r58617:21f2c861a4dc
Date: 2012-10-29 00:42 +0100
http://bitbucket.org/pypy/pypy/changeset/21f2c861a4dc/
Log: progress
diff --git a/pypy/module/_sha/test/test_sha.py b/pypy/module/_sha/test/test_sha.py
--- a/pypy/module/_sha/test/test_sha.py
+++ b/pypy/module/_sha/test/test_sha.py
@@ -3,17 +3,12 @@
"""
import py
-from pypy.conftest import gettestobjspace
class AppTestSHA(object):
+ spaceconfig = dict(usemodules=['_sha'])
def setup_class(cls):
- """
- Create a space with the sha module and import it for use by the
- tests.
- """
- cls.space = gettestobjspace(usemodules=['_sha'])
cls.w_sha = cls.space.appexec([], """():
import sha
return sha
diff --git a/pypy/module/_ssl/test/test_ssl.py b/pypy/module/_ssl/test/test_ssl.py
--- a/pypy/module/_ssl/test/test_ssl.py
+++ b/pypy/module/_ssl/test/test_ssl.py
@@ -1,12 +1,5 @@
-from pypy.conftest import gettestobjspace
-import os
-import py
-
-
class AppTestSSL:
- def setup_class(cls):
- space = gettestobjspace(usemodules=('_ssl', '_socket'))
- cls.space = space
+ spaceconfig = dict(usemodules=('_ssl', '_socket'))
def test_init_module(self):
import _ssl
@@ -89,9 +82,7 @@
class AppTestConnectedSSL:
- def setup_class(cls):
- space = gettestobjspace(usemodules=('_ssl', '_socket', 'struct'))
- cls.space = space
+ spaceconfig = dict(usemodules=('_ssl', '_socket', 'struct'))
def setup_method(self, method):
# https://www.verisign.net/
@@ -177,10 +168,9 @@
class AppTestConnectedSSL_Timeout(AppTestConnectedSSL):
# Same tests, with a socket timeout
# to exercise the poll() calls
+ spaceconfig = dict(usemodules=('_ssl', '_socket', 'struct'))
def setup_class(cls):
- space = gettestobjspace(usemodules=('_ssl', '_socket', 'struct'))
- cls.space = space
cls.space.appexec([], """():
import socket; socket.setdefaulttimeout(1)
""")
diff --git a/pypy/module/_winreg/test/test_winreg.py b/pypy/module/_winreg/test/test_winreg.py
--- a/pypy/module/_winreg/test/test_winreg.py
+++ b/pypy/module/_winreg/test/test_winreg.py
@@ -1,4 +1,3 @@
-from pypy.conftest import gettestobjspace
from pypy.tool.udir import udir
import os, sys, py
@@ -20,9 +19,7 @@
canSaveKey = True
class AppTestHKey:
- def setup_class(cls):
- space = gettestobjspace(usemodules=('_winreg',))
- cls.space = space
+ spaceconfig = dict(usemodules=('_winreg',))
def test_repr(self):
import _winreg
@@ -30,10 +27,11 @@
assert str(k) == "<PyHKEY:0x123>"
class AppTestFfi:
+ spaceconfig = dict(usemodules=('_winreg',))
+
def setup_class(cls):
import _winreg
- space = gettestobjspace(usemodules=('_winreg',))
- cls.space = space
+ space = cls.space
cls.root_key = _winreg.HKEY_CURRENT_USER
cls.test_key_name = "SOFTWARE\\Pypy Registry Test Key - Delete Me"
cls.w_root_key = space.wrap(cls.root_key)
diff --git a/pypy/module/select/test/test_epoll.py b/pypy/module/select/test/test_epoll.py
--- a/pypy/module/select/test/test_epoll.py
+++ b/pypy/module/select/test/test_epoll.py
@@ -1,20 +1,17 @@
import py
import sys
-from pypy.conftest import gettestobjspace
-
# add a larger timeout for slow ARM machines
import platform
class AppTestEpoll(object):
-
+ spaceconfig = dict(usemodules=["select", "_socket", "posix"])
def setup_class(cls):
# NB. we should ideally py.test.skip() if running on an old linux
# where the kernel doesn't support epoll()
if not sys.platform.startswith('linux'):
py.test.skip("test requires linux (assumed >= 2.6)")
- cls.space = gettestobjspace(usemodules=["select", "_socket", "posix"])
def setup_method(self, meth):
self.w_sockets = self.space.wrap([])
diff --git a/pypy/module/select/test/test_kqueue.py b/pypy/module/select/test/test_kqueue.py
--- a/pypy/module/select/test/test_kqueue.py
+++ b/pypy/module/select/test/test_kqueue.py
@@ -3,15 +3,13 @@
import py
import sys
-from pypy.conftest import gettestobjspace
+class AppTestKqueue(object):
+ spaceconfig = dict(usemodules=["select", "_socket", "posix"])
-
-class AppTestKqueue(object):
def setup_class(cls):
if not 'bsd' in sys.platform and \
not sys.platform.startswith('darwin'):
py.test.skip("test requires BSD")
- cls.space = gettestobjspace(usemodules=["select", "_socket", "posix"])
def test_create(self):
import select
diff --git a/pypy/module/select/test/test_select.py b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -1,5 +1,4 @@
import py, sys
-from pypy.conftest import gettestobjspace
class _AppTestSelect:
def test_sleep(self):
@@ -228,11 +227,11 @@
class AppTestSelectWithPipes(_AppTestSelect):
"Use a pipe to get pairs of file descriptors"
+ spaceconfig = dict(usemodules=["select"])
+
def setup_class(cls):
if sys.platform == 'win32':
py.test.skip("select() doesn't work with pipes on win32")
- space = gettestobjspace(usemodules=('select',))
- cls.space = space
def w_getpair(self):
# Wraps a file descriptor in an socket-like object
@@ -255,11 +254,10 @@
"""Same tests with connected sockets.
socket.socketpair() does not exists on win32,
so we start our own server."""
+ spaceconfig = dict(usemodules=["select", "_socket"])
+
def setup_class(cls):
- space = gettestobjspace(usemodules=('select','_socket'))
- cls.space = space
-
- cls.w_getpair = space.wrap(cls.getsocketpair)
+ cls.w_getpair = cls.space.wrap(cls.getsocketpair)
import socket
cls.sock = socket.socket()
diff --git a/pypy/module/signal/test/test_signal.py b/pypy/module/signal/test/test_signal.py
--- a/pypy/module/signal/test/test_signal.py
+++ b/pypy/module/signal/test/test_signal.py
@@ -1,16 +1,15 @@
import os, py, sys
import signal as cpy_signal
-from pypy.conftest import gettestobjspace
class TestCheckSignals:
+ spaceconfig = dict(usemodules=['signal'])
def setup_class(cls):
if not hasattr(os, 'kill') or not hasattr(os, 'getpid'):
py.test.skip("requires os.kill() and os.getpid()")
if not hasattr(cpy_signal, 'SIGUSR1'):
py.test.skip("requires SIGUSR1 in signal")
- cls.space = gettestobjspace(usemodules=['signal'])
def test_checksignals(self):
space = self.space
@@ -36,11 +35,10 @@
class AppTestSignal:
+ spaceconfig = dict(usemodules=['signal'])
def setup_class(cls):
- space = gettestobjspace(usemodules=['signal'])
- cls.space = space
- cls.w_signal = space.appexec([], "(): import signal; return signal")
+ cls.w_signal = cls.space.getbuiltinmodule('signal')
def test_exported_names(self):
import os
@@ -253,10 +251,7 @@
signal.signal(signum, oldhandler)
class AppTestSignalSocket:
-
- def setup_class(cls):
- space = gettestobjspace(usemodules=['signal', '_socket'])
- cls.space = space
+ spaceconfig = dict(usemodules=['signal', '_socket'])
def test_alarm_raise(self):
try:
More information about the pypy-commit
mailing list