def test_dimport(self): import os actual = util.dimport("os") self.assertEqual(actual, os) actual = util.dimport("os.path") self.assertEqual(actual, os.path) actual = util.dimport("os.open") self.assertEqual(actual, os.open) with self.assertRaises(ImportError): util.dimport("foo")
def test_import_file_with_dead_dependency_show_correct_message(self, ipl): # https://github.com/toros-astro/corral/issues/11 with self.assertRaisesRegex(ImportError, "No module named foo"): util.dimport("faa")
def alert(self): return util.dimport(self.alert_path)