From f1313053f92f1947b2bf101cc6dc3759e64317c7 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Thu, 30 May 2024 19:34:43 +0000 Subject: [PATCH] fix(docs): test case ref generation to try multiple dev forks --- docs/gen_test_case_reference.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/docs/gen_test_case_reference.py b/docs/gen_test_case_reference.py index d2f4102e09..a624baa793 100644 --- a/docs/gen_test_case_reference.py +++ b/docs/gen_test_case_reference.py @@ -186,21 +186,24 @@ def run_collect_only(test_path: Path = source_directory) -> Tuple[str, str]: str: The command used to collect the tests. str: A list of the collected tests. """ - buffer = io.StringIO() - with contextlib.redirect_stdout(buffer): - pytest.main(["--collect-only", "-q", "--until", DEV_FORKS[-1], str(test_path)]) - output = buffer.getvalue() - collect_only_command = f"fill --collect-only -q --until {DEV_FORKS[-1]} {test_path}" - # strip out the test module - output_lines = [ - line.split("::")[1] - for line in output.split("\n") - if line.startswith("tests/") and "::" in line - ] - # prefix with required indent for admonition in MARKDOWN_TEST_CASES_TEMPLATE - collect_only_output = "\n".join(" " + line for line in output_lines) - collect_only_output = collect_only_output[4:] # strip out indent for first line - return collect_only_command, collect_only_output + for fork in DEV_FORKS: + collect_only_args = ["--collect-only", "-q", "--until", fork, str(test_path)] + buffer = io.StringIO() + with contextlib.redirect_stdout(buffer): + pytest.main(collect_only_args) + output = buffer.getvalue() + # strip out the test module + output_lines = [ + line.split("::")[1] + for line in output.split("\n") + if line.startswith("tests/") and "::" in line + ] + # prefix with required indent for admonition in MARKDOWN_TEST_CASES_TEMPLATE + collect_only_output = "\n".join(" " + line for line in output_lines) + collect_only_output = collect_only_output[4:] # strip out indent for first line + if collect_only_output: + break + return f'fill {" ".join(collect_only_args)}', collect_only_output def generate_github_url(file_path, branch_or_commit_or_tag="main"):