def test_bad_plugin_name(): with pytest.raises(exc.ContentNameError): loaders.PluginLoader( content_type=constants.ContentType.MODULE, rel_path="plugins/modules/bad-name-dashes.py", root="", )
def loader_doc_fragment(): return loaders.PluginLoader( content_type=constants.ContentType.DOC_FRAGMENTS_PLUGIN, rel_path='plugins/doc_fragments/my_doc_fragment.py', root= '/tmp_placeholder/tmp_placeholder/ansible_collections/my_ns/my_collection', doc_strings=json.loads(ANSIBLE_DOC_OUTPUT))
def loader_module(): return loaders.PluginLoader( content_type=constants.ContentType.MODULE, rel_path='plugins/modules/my_module.py', root= '/tmp_placeholder/tmp_placeholder/ansible_collections/my_ns/my_collection', doc_strings=json.loads(ANSIBLE_DOC_OUTPUT))
def loader_module_subdirs(): return loaders.PluginLoader( content_type=constants.ContentType.MODULE, rel_path='plugins/modules/subdir1/subdir2/my_module_2.py', root= '/tmp_placeholder/tmp_placeholder/ansible_collections/my_ns/my_collection', cfg=SimpleNamespace(run_flake8=False), doc_strings=json.loads(ANSIBLE_DOC_OUTPUT))
def test_ansible_doc_unsupported_type(): loader_action = loaders.PluginLoader( content_type=constants.ContentType.ACTION_PLUGIN, rel_path='plugins/action/my_plugin.py', root='/tmp/tmpiskt5e2n') assert constants.ContentType.ACTION_PLUGIN.value not in \ loaders.ANSIBLE_DOC_SUPPORTED_TYPES assert not loader_action._get_doc_strings()
def loader_doc_fragment(): return loaders.PluginLoader( content_type=constants.ContentType.DOC_FRAGMENTS_PLUGIN, rel_path="plugins/doc_fragments/my_doc_fragment.py", root= "/tmp_placeholder/tmp_placeholder/ansible_collections/my_ns/my_collection", cfg=SimpleNamespace(run_flake8=False), doc_strings=json.loads(ANSIBLE_DOC_OUTPUT), )
def loader_module(): return loaders.PluginLoader( content_type=constants.ContentType.MODULE, rel_path="plugins/modules/my_module.py", root= "/tmp_placeholder/tmp_placeholder/ansible_collections/my_ns/my_collection", cfg=SimpleNamespace(run_flake8=True), doc_strings=json.loads(ANSIBLE_DOC_OUTPUT), )
def loader_module(): return loaders.PluginLoader( content_type=constants.ContentType.MODULE, rel_path='plugins/modules/my_sample_module.py', root='/tmp/tmpiskt5e2n')