[pypy-svn] r75245 - pypy/trunk/pypy/module/zipimport/test

afa at codespeak.net afa at codespeak.net
Thu Jun 10 14:42:14 CEST 2010


Author: afa
Date: Thu Jun 10 14:42:13 2010
New Revision: 75245

Modified:
   pypy/trunk/pypy/module/zipimport/test/test_zipimport.py
Log:
Add a test for the change in import_pyc_file()


Modified: pypy/trunk/pypy/module/zipimport/test/test_zipimport.py
==============================================================================
--- pypy/trunk/pypy/module/zipimport/test/test_zipimport.py	(original)
+++ pypy/trunk/pypy/module/zipimport/test/test_zipimport.py	Thu Jun 10 14:42:13 2010
@@ -222,6 +222,22 @@
                                 + "yy.py")
         assert mod.f(3) == 3
 
+    def test_pyc_in_package(self):
+        import os, sys
+        import new
+        mod = new.module('xxuuw')
+        mod.__path__ = [self.zipfile + '/xxuuw']
+        sys.modules['xxuuw'] = mod
+        #
+        self.writefile(self, "xxuuw/__init__.py", "")
+        self.writefile(self, "xxuuw/zz.pyc", self.test_pyc)
+        mod = __import__("xxuuw.zz", globals(), locals(), ['__doc__'])
+        assert mod.__file__ == (self.zipfile + os.path.sep
+                                + "xxuuw" + os.path.sep
+                                + "zz.pyc")
+        assert mod.get_file() == mod.__file__
+        assert mod.get_name() == mod.__name__
+
     def test_functions(self):
         import os
         import zipimport



More information about the Pypy-commit mailing list