From 0cf9e6a6214d4418286a30e305fefad644b29c52 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 28 Jun 2010 04:57:24 +0000 Subject: Move importlib.abc.SourceLoader to _bootstrap. Required updating code relying on other modules to switch to _bootstrap's unique module requirements. This led to the realization that get_code was being too liberal in its exception catching when calling set_data by blindly grabbing IOError. Shifted the responsibility of safely ignoring writes to a read-only path to set_data. Importlib is still not relying on SourceLoader yet; requires creating a SourcelessLoader and updating the source finder. --- Lib/importlib/test/source/test_abc_loader.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Lib/importlib/test') diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py index 62729b40e7..6bdaadb2e6 100644 --- a/Lib/importlib/test/source/test_abc_loader.py +++ b/Lib/importlib/test/source/test_abc_loader.py @@ -748,10 +748,9 @@ class SourceLoaderBytecodeTests(SourceLoaderTestHarness): return closure self.setUp(magic=b'0000') - for exc in (NotImplementedError, IOError): - self.loader.set_data = raise_exception(exc) - code_object = self.loader.get_code(self.name) - self.verify_code(code_object) + self.loader.set_data = raise_exception(NotImplementedError) + code_object = self.loader.get_code(self.name) + self.verify_code(code_object) class AbstractMethodImplTests(unittest.TestCase): -- cgit v1.2.1