Author: Manuel Jacob <m...@manueljacob.de>
Branch: py3.3
Changeset: r82143:7ce8c80e23e7
Date: 2016-02-10 14:18 +0100
http://bitbucket.org/pypy/pypy/changeset/7ce8c80e23e7/

Log:    Remove tests which call importing.load_source_module(). This
        function was removed.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -915,106 +915,6 @@
         finally:
             stream.close()
 
-    def test_load_source_module(self):
-        space = self.space
-        w_modulename = space.wrap('somemodule')
-        w_mod = space.wrap(Module(space, w_modulename))
-        pathname = _testfilesource()
-        stream = streamio.open_file_as_stream(pathname, "r")
-        try:
-            w_ret = importing.load_source_module(
-                space, w_modulename, w_mod,
-                pathname, stream.readall(),
-                stream.try_to_find_file_descriptor())
-        finally:
-            stream.close()
-        assert w_mod is w_ret
-        w_ret = space.getattr(w_mod, space.wrap('x'))
-        ret = space.int_w(w_ret)
-        assert ret == 42
-
-        cpathname = udir.join('test.pyc')
-        assert cpathname.check()
-        cpathname.remove()
-
-    def test_load_source_module_nowrite(self):
-        space = self.space
-        w_modulename = space.wrap('somemodule')
-        w_mod = space.wrap(Module(space, w_modulename))
-        pathname = _testfilesource()
-        stream = streamio.open_file_as_stream(pathname, "r")
-        try:
-            w_ret = importing.load_source_module(
-                space, w_modulename, w_mod,
-                pathname, stream.readall(),
-                stream.try_to_find_file_descriptor(),
-                write_pyc=False)
-        finally:
-            stream.close()
-        cpathname = udir.join('test.pyc')
-        assert not cpathname.check()
-
-    def test_load_source_module_dont_write_bytecode(self):
-        space = self.space
-        w_modulename = space.wrap('somemodule')
-        w_mod = space.wrap(Module(space, w_modulename))
-        pathname = _testfilesource()
-        stream = streamio.open_file_as_stream(pathname, "r")
-        try:
-            space.setattr(space.sys, space.wrap('dont_write_bytecode'),
-                          space.w_True)
-            w_ret = importing.load_source_module(
-                space, w_modulename, w_mod,
-                pathname, stream.readall(),
-                stream.try_to_find_file_descriptor())
-        finally:
-            space.setattr(space.sys, space.wrap('dont_write_bytecode'),
-                          space.w_False)
-            stream.close()
-        cpathname = udir.join('test.pyc')
-        assert not cpathname.check()
-
-    def test_load_source_module_syntaxerror(self):
-        # No .pyc file on SyntaxError
-        space = self.space
-        w_modulename = space.wrap('somemodule')
-        w_mod = space.wrap(Module(space, w_modulename))
-        pathname = _testfilesource(source="<Syntax Error>")
-        stream = streamio.open_file_as_stream(pathname, "r")
-        try:
-            w_ret = importing.load_source_module(
-                space, w_modulename, w_mod,
-                pathname, stream.readall(),
-                stream.try_to_find_file_descriptor())
-        except OperationError:
-            # OperationError("Syntax Error")
-            pass
-        stream.close()
-
-        cpathname = udir.join('test.pyc')
-        assert not cpathname.check()
-        
-    def test_load_source_module_importerror(self):
-        # the .pyc file is created before executing the module
-        space = self.space
-        w_modulename = space.wrap('somemodule')
-        w_mod = space.wrap(Module(space, w_modulename))
-        pathname = _testfilesource(source="a = unknown_name")
-        stream = streamio.open_file_as_stream(pathname, "r")
-        try:
-            w_ret = importing.load_source_module(
-                space, w_modulename, w_mod,
-                pathname, stream.readall(),
-                stream.try_to_find_file_descriptor())
-        except OperationError:
-            # OperationError("NameError", "global name 'unknown_name' is not 
defined")
-            pass
-        stream.close()
-
-        # And the .pyc has been generated
-        cpathname = udir.join(importing.make_compiled_pathname('test.py'))
-        assert cpathname.check()
-
     def test_pyc_magic_changes(self):
         py.test.skip("For now, PyPy generates only one kind of .pyc files")
         # test that the pyc files produced by a space are not reimportable
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to