def test_failed_hook(self):
        def h(mod):
            raise RuntimeError

        imports.when_imported('spam', h)

        try:
            import spam
        except Exception, e:
            pass
        else:
            self.fail('expected exception')

        self.assertFalse('spam' in self.finder.loaded_modules)

        self.assertEqual(e.__class__, RuntimeError)
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/tests/test_imports.py/WhenImportedTestCase.test_failed_hook/original