Example #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")
Example #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")
Example #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")
Example #4
0
 def alert(self):
     return util.dimport(self.alert_path)
Example #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")
Example #6
0
 def alert(self):
     return util.dimport(self.alert_path)