[pypy-commit] pypy py3k: skip frozen module/imp.init_builtin/objspace.lonepycfiles=False tests

pjenvey noreply at buildbot.pypy.org
Wed Dec 19 00:44:57 CET 2012


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r59495:8a8a1251d15d
Date: 2012-12-18 15:36 -0800
http://bitbucket.org/pypy/pypy/changeset/8a8a1251d15d/

Log:	skip frozen module/imp.init_builtin/objspace.lonepycfiles=False
	tests

diff --git a/lib-python/3.2/importlib/test/builtin/test_loader.py b/lib-python/3.2/importlib/test/builtin/test_loader.py
--- a/lib-python/3.2/importlib/test/builtin/test_loader.py
+++ b/lib-python/3.2/importlib/test/builtin/test_loader.py
@@ -3,6 +3,7 @@
 from .. import abc
 from .. import util
 from . import util as builtin_util
+from test.support import impl_detail, run_unittest
 
 import sys
 import types
@@ -44,6 +45,8 @@
         # Not way to force an imoprt failure.
         pass
 
+    @impl_detail("cannot initialize a built-in module twice in PyPy",
+                 pypy=False)
     def test_module_reuse(self):
         # Test that the same module is used in a reload.
         with util.uncache(builtin_util.NAME):
@@ -94,7 +97,6 @@
 
 
 def test_main():
-    from test.support import run_unittest
     run_unittest(LoaderTests, InspectLoaderTests)
 
 
diff --git a/lib-python/3.2/importlib/test/frozen/test_finder.py b/lib-python/3.2/importlib/test/frozen/test_finder.py
--- a/lib-python/3.2/importlib/test/frozen/test_finder.py
+++ b/lib-python/3.2/importlib/test/frozen/test_finder.py
@@ -2,6 +2,7 @@
 from .. import abc
 
 import unittest
+from test.support import impl_detail, run_unittest
 
 
 class FinderTests(abc.FinderTests):
@@ -12,15 +13,18 @@
         finder = machinery.FrozenImporter
         return finder.find_module(name, path)
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_module(self):
         name = '__hello__'
         loader = self.find(name)
         self.assertTrue(hasattr(loader, 'load_module'))
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_package(self):
         loader = self.find('__phello__')
         self.assertTrue(hasattr(loader, 'load_module'))
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_module_in_package(self):
         loader = self.find('__phello__.spam', ['__phello__'])
         self.assertTrue(hasattr(loader, 'load_module'))
@@ -39,7 +43,6 @@
 
 
 def test_main():
-    from test.support import run_unittest
     run_unittest(FinderTests)
 
 
diff --git a/lib-python/3.2/importlib/test/frozen/test_loader.py b/lib-python/3.2/importlib/test/frozen/test_loader.py
--- a/lib-python/3.2/importlib/test/frozen/test_loader.py
+++ b/lib-python/3.2/importlib/test/frozen/test_loader.py
@@ -3,10 +3,11 @@
 import unittest
 from .. import abc
 from .. import util
-from test.support import captured_stdout
+from test.support import captured_stdout, impl_detail
 
 class LoaderTests(abc.LoaderTests):
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_module(self):
         with util.uncache('__hello__'), captured_stdout() as stdout:
             module = machinery.FrozenImporter.load_module('__hello__')
@@ -16,6 +17,7 @@
                 self.assertEqual(getattr(module, attr), value)
             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_package(self):
         with util.uncache('__phello__'),  captured_stdout() as stdout:
             module = machinery.FrozenImporter.load_module('__phello__')
@@ -29,6 +31,7 @@
                                  (attr, attr_value, value))
             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_lacking_parent(self):
         with util.uncache('__phello__', '__phello__.spam'), \
              captured_stdout() as stdout:
@@ -43,6 +46,7 @@
                                  (attr, attr_value, value))
             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_module_reuse(self):
         with util.uncache('__hello__'), captured_stdout() as stdout:
             module1 = machinery.FrozenImporter.load_module('__hello__')
@@ -65,6 +69,7 @@
 
     """Tests for the InspectLoader methods for FrozenImporter."""
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_get_code(self):
         # Make sure that the code object is good.
         name = '__hello__'
@@ -75,11 +80,13 @@
             self.assertTrue(hasattr(mod, 'initialized'))
             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_get_source(self):
         # Should always return None.
         result = machinery.FrozenImporter.get_source('__hello__')
         self.assertTrue(result is None)
 
+    @impl_detail("pypy doesn't support frozen modules", pypy=False)
     def test_is_package(self):
         # Should be able to tell what is a package.
         test_for = (('__hello__', False), ('__phello__', True),
diff --git a/lib-python/3.2/test/test_import.py b/lib-python/3.2/test/test_import.py
--- a/lib-python/3.2/test/test_import.py
+++ b/lib-python/3.2/test/test_import.py
@@ -14,9 +14,9 @@
 import errno
 
 from test.support import (
-    EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
-    make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
-    unlink, unload)
+    EnvironmentVarGuard, TESTFN, check_impl_detail, check_warnings, forget,
+    impl_detail, is_jython, make_legacy_pyc, rmtree, run_unittest, swap_attr,
+    swap_item, temp_umask, unlink, unload)
 from test import script_helper
 
 
@@ -166,7 +166,9 @@
             # Bytecode must be relocated from the PEP 3147 bytecode-only location.
             py_compile.compile(filename)
         finally:
-            unlink(filename)
+            if check_impl_detail(pypy=False):
+                # pypy refuses to import a .pyc if the .py does not exist
+                unlink(filename)
 
         # Need to be able to load from current dir.
         sys.path.append('')
@@ -249,6 +251,7 @@
             remove_files(TESTFN)
             unload(TESTFN)
 
+    @impl_detail("pypy refuses to import without a .py source", pypy=False)
     def test_file_to_source(self):
         # check if __file__ points to the source file where available
         source = TESTFN + ".py"
@@ -396,6 +399,7 @@
         self.assertEqual(mod.code_filename, self.file_name)
         self.assertEqual(mod.func_filename, self.file_name)
 
+    @impl_detail("pypy refuses to import without a .py source", pypy=False)
     def test_module_without_source(self):
         target = "another_module.py"
         py_compile.compile(self.file_name, dfile=target)
@@ -593,6 +597,7 @@
         forget(TESTFN)
         self.assertRaises(ImportError, __import__, TESTFN)
 
+    @impl_detail("pypy refuses to import without a .py source", pypy=False)
     def test_missing_source_legacy(self):
         # Like test_missing_source() except that for backward compatibility,
         # when the pyc file lives where the py file would have been (and named
@@ -613,6 +618,7 @@
         pyc_file = imp.cache_from_source(TESTFN + '.py')
         self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file))
 
+    @impl_detail("pypy refuses to import without a .py source", pypy=False)
     def test___cached___legacy_pyc(self):
         # Like test___cached__() except that for backward compatibility,
         # when the pyc file lives where the py file would have been (and named


More information about the pypy-commit mailing list