예제 #1
0
    def get_module(self):
        """Load the module for this challenge part"""
        module = try_import_module(self.module_name)
        if not module:
            click.echo(f"Could not find {e_error(self.module_name)}")

        return module
예제 #2
0
 def test_import_module_with_cyclical_imports(self):
     with self.assertRaises(AttributeError):
         try_import_module(
             'tests.test_utils.modules_for_test.cyclic_import_a')
예제 #3
0
 def test_import_module_with_error(self):
     with self.assertRaises(ZeroDivisionError):
         try_import_module(
             'tests.test_utils.modules_for_test.module_with_error')
예제 #4
0
 def test_import_missing_module(self):
     module = try_import_module(
         'tests.test_utils.modules_for_test.missing_module')
     self.assertIsNone(module)
예제 #5
0
 def test_import_existing_module(self):
     module = try_import_module(
         'tests.test_utils.modules_for_test.normal_module')
     self.assertIsNotNone(module)
     self.assertEqual(module.VALUE, 1)