def test_error_parent_module(self):
     """Test to import a non-existing parent module
     """
     with self.assertRaisesRegex(
             customization.InvalidObjectModuleNameError,
             "No module notexistingmodule found",
     ):
         customization.import_custom_object("notexistingmodule.sub")
 def test_error_module(self):
     """Test to import a non-existing module
     """
     with self.assertRaisesRegex(
             customization.InvalidObjectModuleNameError,
             "No module or object notexistingmodule found in tests.resources",
     ):
         customization.import_custom_object(
             "tests.resources.notexistingmodule")
 def test_error_sub_object(self):
     """Test to import a non-existing sub object
     """
     with self.assertRaisesRegex(
             customization.InvalidObjectModuleNameError,
             "No module or object notexistingattribute found in "
             "tests.resources.my_module.MyClass",
     ):
         customization.import_custom_object(
             "tests.resources.my_module.MyClass.notexistingattribute")
 def test_import_static_attribute(self):
     """Test to import a class static attribute
     """
     attribute = customization.import_custom_object(
         "tests.resources.my_module.MyClass.my_attribute")
     self.assertEqual(attribute, 42)
 def test_import_class(self):
     """Test to import a class
     """
     klass = customization.import_custom_object(
         "tests.resources.my_module.MyClass")
     self.assertTrue(inspect.isclass(klass))
 def test_import_parent_module(self):
     """Test to import a parent module
     """
     module = customization.import_custom_object("tests.resources")
     self.assertTrue(inspect.ismodule(module))