Пример #1
0
    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")
Пример #2
0
    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")
Пример #3
0
 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")
Пример #4
0
 def alert(self):
     return util.dimport(self.alert_path)
Пример #5
0
 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")
Пример #6
0
 def alert(self):
     return util.dimport(self.alert_path)