##### SUMMARY
The collection loader currently imports a number of things from Ansible, the heaviest of which is config/constants. This makes it heavyweight and somewhat dangerous for ansible-test and unit tests to use. Refactor it to minimize those imports and supply the necessary impls another way (constructor, DI pattern, etc).

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME
AnsibleCollectionLoader

##### ADDITIONAL INFORMATION

if basename == '__init__' or basename in _PLUGIN_FILTERS[self.package]:
                continue
            if dedupe and basename in loaded_modules:
                continue
            loaded_modules.add(basename)
            if path_only:
                yield path
                continue
            if path not in self._module_cache:
                try:
                    if self.subdir in ('filter_plugins', 'test_plugins'):
                        
                        
                        full_name = '{0}_{1}'.format(abs(hash(path)), basename)
                    else:
                        full_name = basename
                    module = self._load_module_source(full_name, path)
                    self._load_config_defs(basename, module, path)
                except Exception as e:
                    display.warning("Skipping plugin (%s) as it seems to be invalid: %s" % (path, to_text(e)))
                    continue
                self._module_cache[path] = module
                found_in_cache = False
            try:
                obj = getattr(self._module_cache[path], self.class_name)
            except AttributeError as e:
                display.warning("Skipping plugin (%s) as it seems to be invalid: %s" % (path, to_text(e)))
                continue
            if self.base_class: