def test_get_sidebar_default(): """ """ load_config(exclude=["sidebar"]) load_and_validate() response = config_manager.get("sidebar") assert response is False
def test_get_python_default(): """ """ load_config(exclude=["python"]) load_and_validate() response = config_manager.get("python") assert response is None
def test_get_title_prefix_default(): """ """ load_config(exclude=["title_prefix"]) load_and_validate() response = config_manager.get("title_prefix") assert response == ""
def test_get_sidebar(): """ """ expected = True load_config(sidebar=expected) load_and_validate() response = config_manager.get("sidebar") assert response == expected
def test_get_titles(): """ """ expected = [{"source": "mysourcefile.py", "title": "wowsuchdocs"}] load_config(titles=expected) load_and_validate() response = config_manager.get("titles") assert response == expected
def test_get_title_prefix(): """ """ expected = "myprefix" load_config(title_prefix=expected) load_and_validate() response = config_manager.get("title_prefix") assert response == expected
def test_get_python(): """ """ expected = { "include_init_files": True, "include_main_file": True, "module": "mymod", } load_config(python=expected) load_and_validate() response = config_manager.get("python") assert response == expected
def main(): ga = GithubAction( "stephend017", "pencil-pusher", os.environ, os.environ["INPUT_GITHUB_TOKEN"], {"repository"}, ) Documenter.install() gh = GithubAPI(ga.inputs["github_token"]) owner_name = ga.builtins["repository"].split("/")[0] repository_name = ga.builtins["repository"].split("/")[1] rm = RepoManager(owner_name, repository_name, gh) rm.setup() rm.install() # load configs for the given file config_manager.load_config_file( f'{rm._repo_path}/{ga.inputs["config_file"]}') config_manager.validate() langs = config_manager.get_langs() extensions = [] for _, ext_list in langs.items(): for ext in ext_list: extensions.append(ext) # transform titles config into usable dict titles = {} for element in config_manager.get("titles"): has_defined_ext = False for ext in extensions: if element["source"].endswith(f".{ext}"): has_defined_ext = True titles[element["source"][:-(len(ext) + 1)]] = element["title"] if not has_defined_ext: titles[element["source"]] = element["title"] # only support default for now (repo_name = package_name) rm.document( sources=config_manager.get("sources"), module="" if not config_manager.has("python") else config_manager.get("python")["module"], title_prefix=config_manager.get("title_prefix"), title_suffix=config_manager.get("title_suffix"), titles=titles, extensions=extensions, sidebar=config_manager.get("sidebar"), ) rm.publish() rm.cleanup()
def test_get_values(): """ tests that config values are loaded properly """ expected = [ "path1/*", "path1/anotherpath/*", "path1/anotherpath2/", "path1/anotherpath2/file1.py", ] load_config(sources=expected) load_and_validate() response = config_manager.get("sources") assert len(expected) == len(response) for path in expected: assert path in response