def METHOD_NAME(self):
    def __init__():
        import pkg.module
        1/0
    mock = util.mock_spec('pkg.__init__', 'pkg.module',
                             module_code={'pkg': __init__})
    with mock:
        with util.import_state(meta_path=[mock]):
            with self.assertRaises(ZeroDivisionError):
                self.__import__('pkg')
            self.assertNotIn('pkg', sys.modules)
            self.assertIn('pkg.module', sys.modules)
            with self.assertRaises(ZeroDivisionError):
                self.__import__('pkg.module')
            self.assertNotIn('pkg', sys.modules)
            self.assertIn('pkg.module', sys.modules)