Commit 4e6a999a authored by Matti Picus's avatar Matti Picus
Browse files

move test that used to use _ssl to _demo

parent d6217bf98b7c
......@@ -158,25 +158,3 @@ class TestMixedModule:
w_str = space1.getattr(w_mymod1, space1.wrap("hi"))
assert space1.str_w(w_str) == "hello"
class TestMixedModuleUnfreeze:
spaceconfig = dict(usemodules=('_ssl', '_socket'))
def test_random_stuff_can_unfreeze(self):
# When a module contains an "import" statement in applevel code, the
# imported module is initialized, possibly after it has been already
# frozen.
# This is important when the module startup() function does something
# at runtime, like setting os.environ (posix module) or initializing
# the winsock library (_socket module)
w_socket = self.space.builtin_modules['_socket']
w_ssl = self.space.builtin_modules['_ssl']
# Uncomment this line for a workaround
# space.getattr(w_ssl, space.wrap('SSLError'))
w_socket._cleanup_()
assert w_socket.startup_called == False
w_ssl._cleanup_() # w_ssl.appleveldefs['SSLError'] imports _socket
assert w_socket.startup_called == False
# import posix underneath
from os import environ
# for the test_random_stuff_can_unfreeze test
environ['PYPY_DEMO_MODULE_ERROR'] = '1'
class DemoError(Exception):
pass
......@@ -28,3 +28,23 @@ class TestImport:
assert Module.demo_events == ['setup', 'startup']
assert space.getattr(w_demo, space.wrap('measuretime'))
class TestMixedModuleUnfreeze:
spaceconfig = dict(usemodules=('_demo', 'posix'))
def test_random_stuff_can_unfreeze(self):
# When a module contains an "import" statement in applevel code, the
# imported module is initialized, possibly after it has been already
# frozen.
# This is important when the module startup() function does something
# at runtime, like setting os.environ (posix module) or initializing
# the winsock library (_socket module)
w_posix = self.space.builtin_modules['posix']
w_demo = self.space.builtin_modules['_demo']
w_posix._cleanup_()
assert w_posix.startup_called == False
w_demo._cleanup_() # w_demo.appleveldefs['DemoError'] imports posix
assert w_posix.startup_called == False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment