Skip to content

Commit 08288b8

Browse files
committed
fix paths for doc generation
1 parent c72f7f1 commit 08288b8

File tree

5 files changed

+69
-35
lines changed

5 files changed

+69
-35
lines changed

docs/scripts/copy_repo_docs_to_mkdocs.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Include EEST's CONTRIBUTING.md and SECURITY.md in the HTML documentation."""
22

33
import logging
4+
import os
45
import re
56
from pathlib import Path
67

@@ -16,7 +17,7 @@ def copy_markdown_file(source_path, destination_path, fix_links=True):
1617

1718
if not source_file.is_file():
1819
raise FileNotFoundError(
19-
f"Error: Source file '{source_file}' not found in current directory."
20+
f"Error: Source file '{source_file}' not found at '{os.getcwd()}'."
2021
)
2122

2223
try:
@@ -26,7 +27,9 @@ def copy_markdown_file(source_path, destination_path, fix_links=True):
2627
if fix_links:
2728
# Fix absolute website links to relative docs links
2829
line = re.sub(
29-
r"https://eest\.ethereum\.org/main/([^)\s]+)", r"../\1.md", line
30+
r"https://eest\.ethereum\.org/main/([^)\s]+)",
31+
r"../\1.md",
32+
line,
3033
)
3134

3235
# Fix SECURITY.md link
@@ -45,7 +48,9 @@ def copy_markdown_file(source_path, destination_path, fix_links=True):
4548

4649
destination.write(line)
4750
except Exception as e:
48-
raise Exception(f"Error copying file {source_file} to {destination_file}") from e
51+
raise Exception(
52+
f"Error copying file {source_file} to {destination_file}"
53+
) from e
4954

5055
logger.info(f"Copied {source_file} to {destination_file}.")
5156

docs/scripts/gen_test_case_reference.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,46 @@
1111
import sys
1212
from os import getenv
1313

14+
import execution_testing.cli.pytest_commands.plugins.filler.gen_test_doc.gen_test_doc as gen_test_doc # noqa E501
1415
import pytest
1516
from click.testing import CliRunner
17+
from execution_testing.cli.pytest_commands.fill import fill
18+
from execution_testing.config import DocsConfig
1619

17-
import pytest_plugins.filler.gen_test_doc.gen_test_doc as gen_test_doc
18-
from cli.pytest_commands.fill import fill
19-
from config import DocsConfig
20-
21-
importlib.reload(gen_test_doc) # get changes in plugin to trigger an update for `mkdocs serve`
20+
importlib.reload(
21+
gen_test_doc
22+
) # get changes in plugin to trigger an update for `mkdocs serve`
2223

2324
TARGET_FORK = DocsConfig().TARGET_FORK
2425
GENERATE_UNTIL_FORK = DocsConfig().GENERATE_UNTIL_FORK
2526

2627
logger = logging.getLogger("mkdocs")
2728

2829

29-
# if docs are generated while FAST_DOCS is true, then use "tests/frontier" otherwise use "tests"
30+
# If docs are generated while FAST_DOCS is true, then use "tests/frontier"
31+
# otherwise use "tests"
32+
#
3033
# USAGE 1 (use fast mode):
3134
# export FAST_DOCS=true && uv run mkdocs serve
3235
# USAGE 2 (use fast mode + hide side-effect warnings):
33-
# export FAST_DOCS=true && uv run mkdocs serve 2>&1 | sed '/is not found among documentation files/d' # noqa: E501
36+
# export FAST_DOCS=true && uv run mkdocs serve 2>&1 | sed '/is not found among documentation files/d' #noqa: E501
3437
test_arg = "tests"
3538
fast_mode = getenv("FAST_DOCS")
3639
if fast_mode is not None:
3740
if fast_mode.lower() == "true":
38-
print("-" * 40, "\nWill generate docs using FAST_DOCS mode.\n" + "-" * 40)
41+
print(
42+
"-" * 40, "\nWill generate docs using FAST_DOCS mode.\n" + "-" * 40
43+
)
3944
test_arg = "tests/frontier"
4045

4146
args = [
4247
"--override-ini",
43-
"filterwarnings=ignore::pytest.PytestAssertRewriteWarning", # suppress warnings due to reload
48+
# suppress warnings due to reload ⬇️
49+
"filterwarnings=ignore::pytest.PytestAssertRewriteWarning",
4450
"-p",
45-
"pytest_plugins.filler.gen_test_doc.gen_test_doc",
51+
"execution_testing.cli.filler.gen_test_doc.gen_test_doc",
4652
"-p",
47-
"pytest_plugins.filler.eip_checklist",
53+
"execution_testing.cli.filler.eip_checklist",
4854
"--gen-docs",
4955
f"--gen-docs-target-fork={TARGET_FORK}",
5056
f"--until={GENERATE_UNTIL_FORK}",
@@ -58,19 +64,24 @@
5864

5965
runner = CliRunner()
6066
logger.info(
61-
f"Generating documentation for test cases until {GENERATE_UNTIL_FORK} as fill {' '.join(args)}"
67+
f"Generating documentation for test cases until {GENERATE_UNTIL_FORK} as \
68+
fill {' '.join(args)}"
6269
)
6370
result = runner.invoke(fill, args)
6471
for line in result.output.split("\n"):
6572
if "===" in line:
6673
logger.info(line.replace("===", "=="))
6774
continue
6875
logger.info(line)
69-
if result.exit_code in [pytest.ExitCode.OK, pytest.ExitCode.NO_TESTS_COLLECTED]:
76+
if result.exit_code in [
77+
pytest.ExitCode.OK,
78+
pytest.ExitCode.NO_TESTS_COLLECTED,
79+
]:
7080
logger.info("Documentation generation successful.")
7181
sys.exit(0)
7282
logger.error(
73-
f"Documentation generation failed (exit: {pytest.ExitCode(result.exit_code)}, "
83+
f"Documentation generation failed (exit: \
84+
{pytest.ExitCode(result.exit_code)}, "
7485
f"{pytest.ExitCode(result.exit_code).name})."
7586
)
7687
sys.exit(result.exit_code)

docs/scripts/generate_fill_help.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ def format_help_output(help_text: str, max_width: int = 88) -> str:
5151

5252
for line in lines:
5353
# Don't wrap lines that are part of the usage section or are empty
54-
if not line.strip() or line.startswith("usage:") or line.startswith(" ") and "--" in line:
54+
if (
55+
not line.strip()
56+
or line.startswith("usage:")
57+
or line.startswith(" ")
58+
and "--" in line
59+
):
5560
formatted_lines.append(line)
5661
else:
5762
# Wrap long lines while preserving indentation
@@ -80,9 +85,10 @@ def generate_command_line_options_docs():
8085
# Create the complete page content
8186
page_content = f"""# Fill Command-Line Options
8287
83-
Fill is a [pytest](https://docs.pytest.org/en/stable/)-based command. This page lists custom
84-
options that the `fill` command provides. To see the full list of options that is available
85-
to fill (including the standard pytest and plugin command-line options) use `fill --pytest-help`.
88+
Fill is a [pytest](https://docs.pytest.org/en/stable/)-based command. This page
89+
lists custom options that the `fill` command provides. To see the full list of
90+
options that is available to fill (including the standard pytest and plugin
91+
command-line options) use `fill --pytest-help`.
8692
8793
*This page is automatically generated from the current `fill --help` output.*
8894
@@ -98,10 +104,15 @@ def generate_command_line_options_docs():
98104
"""
99105

100106
# Write the generated content to a virtual file
101-
with mkdocs_gen_files.open("filling_tests/filling_tests_command_line_options.md", "w") as f:
107+
with mkdocs_gen_files.open(
108+
"filling_tests/filling_tests_command_line_options.md", "w"
109+
) as f:
102110
f.write(page_content)
103111

104-
logger.info("Generated filling_tests_command_line_options.md with current fill --help output")
112+
logger.info(
113+
"Generated filling_tests_command_line_options.md with current fill \
114+
--help output"
115+
)
105116

106117

107118
# Run the generation

scripts/add_to_whitelist.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import os
55

6+
67
def main():
78
# Get words from command-line arguments
89
new_words = sys.argv[1:]
@@ -12,15 +13,17 @@ def main():
1213
print("Example: ./whitelist_manager.py foo bar baz")
1314
sys.exit(1)
1415

15-
whitelist_file = 'whitelist.txt'
16+
whitelist_file = "whitelist.txt"
1617

1718
# Read existing whitelist (create empty list if file doesn't exist)
1819
existing_words = []
1920
if os.path.exists(whitelist_file):
20-
with open(whitelist_file, 'r', encoding='utf-8') as f:
21+
with open(whitelist_file, "r", encoding="utf-8") as f:
2122
content = f.read()
22-
existing_words = [w.strip() for w in content.split('\n') if w.strip()]
23-
print(f"Read {len(existing_words)} existing entries from {whitelist_file}")
23+
existing_words = [w.strip() for w in content.split("\n") if w.strip()]
24+
print(
25+
f"Read {len(existing_words)} existing entries from {whitelist_file}"
26+
)
2427
else:
2528
print(f"Creating new {whitelist_file}")
2629

@@ -36,26 +39,30 @@ def main():
3639

3740
# Add blank lines before each new letter
3841
words_with_separators = []
39-
previous_letter = ''
42+
previous_letter = ""
4043

4144
for word in sorted_words:
4245
current_letter = word[0].lower()
4346

4447
# If we're starting a new letter (and it's not the first word), add a blank line
45-
if current_letter != previous_letter and len(words_with_separators) > 0:
46-
words_with_separators.append('')
48+
if (
49+
current_letter != previous_letter
50+
and len(words_with_separators) > 0
51+
):
52+
words_with_separators.append("")
4753

4854
words_with_separators.append(word)
4955
previous_letter = current_letter
5056

5157
# Create the whitelist content
52-
whitelist_content = '\n'.join(words_with_separators)
58+
whitelist_content = "\n".join(words_with_separators)
5359

5460
# Write to whitelist file
55-
with open(whitelist_file, 'w', encoding='utf-8') as f:
61+
with open(whitelist_file, "w", encoding="utf-8") as f:
5662
f.write(whitelist_content)
5763

5864
print(f"\nSuccessfully updated {whitelist_file}")
5965

60-
if __name__ == '__main__':
66+
67+
if __name__ == "__main__":
6168
main()

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ setenv =
139139
# https://squidfunk.github.io/mkdocs-material/plugins/requirements/image-processing/?h=cairo#cairo-library-was-not-found
140140
package = editable
141141
commands =
142-
ruff check --no-fix --show-fixes docs/scripts
143-
ruff format --check docs/scripts
142+
ruff check --no-fix --show-fixes docs/scripts/
143+
ruff format --check docs/scripts/
144144
mkdocs build --strict
145145

146146
[testenv:markdownlint]

0 commit comments

Comments
 (0)