1 # Test the frozen module defined in frozen.c.
3 from test
.test_support
import captured_stdout
, run_unittest
7 class FrozenTests(unittest
.TestCase
):
10 with
captured_stdout() as stdout
:
13 except ImportError, x
:
14 self
.fail("import __hello__ failed:" + str(x
))
18 except ImportError, x
:
19 self
.fail("import __phello__ failed:" + str(x
))
22 import __phello__
.spam
23 except ImportError, x
:
24 self
.fail("import __phello__.spam failed:" + str(x
))
31 self
.fail("import __phello__.foo should have failed")
33 self
.assertEquals(stdout
.getvalue(),
34 'Hello world...\nHello world...\nHello world...\n')
36 del sys
.modules
['__hello__']
37 del sys
.modules
['__phello__']
38 del sys
.modules
['__phello__.spam']
42 run_unittest(FrozenTests
)
46 if __name__
== '__main__':