Philip Jenvey avatar Philip Jenvey committed 8a8a125

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

Comments (0)

Files changed (4)

lib-python/3.2/importlib/test/builtin/test_loader.py

 from .. import abc
 from .. import util
 from . import util as builtin_util
+from test.support import impl_detail, run_unittest
 
 import sys
 import types
         # 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):
 
 
 def test_main():
-    from test.support import run_unittest
     run_unittest(LoaderTests, InspectLoaderTests)
 
 

lib-python/3.2/importlib/test/frozen/test_finder.py

 from .. import abc
 
 import unittest
+from test.support import impl_detail, run_unittest
 
 
 class FinderTests(abc.FinderTests):
         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'))
 
 
 def test_main():
-    from test.support import run_unittest
     run_unittest(FinderTests)
 
 

lib-python/3.2/importlib/test/frozen/test_loader.py

 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__')
                 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__')
                                  (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:
                                  (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__')
 
     """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__'
             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),

lib-python/3.2/test/test_import.py

 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
 
 
             # 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('')
             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"
         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)
         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
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.