[Python-checkins] r52191 - sandbox/trunk/import_in_py/test_importer.py

brett.cannon python-checkins at python.org
Thu Oct 5 21:36:24 CEST 2006


Author: brett.cannon
Date: Thu Oct  5 21:36:23 2006
New Revision: 52191

Modified:
   sandbox/trunk/import_in_py/test_importer.py
Log:
Add tests for the frozen module importer.


Modified: sandbox/trunk/import_in_py/test_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/test_importer.py	(original)
+++ sandbox/trunk/import_in_py/test_importer.py	Thu Oct  5 21:36:23 2006
@@ -2,6 +2,7 @@
 from test import test_support
 import importer
 import sys
+import StringIO
 
 
 class BuiltinFrozen_Tester(unittest.TestCase):
@@ -89,12 +90,25 @@
     
     """
 
-    pass
+    importer = importer.FrozenImporter
+    module_name = '__hello__'
+    bad_module_names = ('tokenize', 'time', 'sys')
+
+    def setUp(self):
+        """Importing the testing frozen modules outputs to stdout.  Redirect
+        stdout to block that."""
+        self._orig_stdout = sys.stdout
+        sys.stdout = StringIO.StringIO()
+
+    def tearDown(self):
+        """Reset stdout to what it is by default."""
+        sys.stdout = self._orig_stdout
 
 
 def test_main():
     test_support.run_unittest(
                 BuiltinImporterTests,
+                FrozenImporterTests,
             )
 
 


More information about the Python-checkins mailing list