Skip to content

Commit

Permalink
fix(docs): test case ref generation to try multiple dev forks
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed May 30, 2024
1 parent a6df183 commit f131305
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions docs/gen_test_case_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down

0 comments on commit f131305

Please sign in to comment.