Skip to content

Commit 9441c37

Browse files
Add architecture guard for python3 command consistency
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 04511a1 commit 9441c37

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ This runs lint, format checks, compile checks, tests, and package build.
9393
- `tests/test_polling_loop_usage.py` (`while True` polling-loop centralization in `hyperbrowser/client/polling.py`),
9494
- `tests/test_core_type_helper_usage.py` (core transport/config/header/file/polling/session/error/parsing manager+tool module enforcement of shared plain-type helper usage),
9595
- `tests/test_contributing_architecture_guard_listing.py` (`CONTRIBUTING.md` architecture-guard inventory completeness enforcement),
96-
- `tests/test_examples_syntax.py` (example script syntax guardrail).
96+
- `tests/test_examples_syntax.py` (example script syntax guardrail),
97+
- `tests/test_docs_python3_commands.py` (`README`/`CONTRIBUTING`/examples python3 command consistency enforcement).
9798

9899
## Code quality conventions
99100

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"tests/test_core_type_helper_usage.py",
2424
"tests/test_contributing_architecture_guard_listing.py",
2525
"tests/test_examples_syntax.py",
26+
"tests/test_docs_python3_commands.py",
2627
)
2728

2829

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import re
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
pytestmark = pytest.mark.architecture
7+
8+
9+
def test_readme_and_contributing_use_python3_commands():
10+
readme_text = Path("README.md").read_text(encoding="utf-8")
11+
contributing_text = Path("CONTRIBUTING.md").read_text(encoding="utf-8")
12+
13+
assert "python -m" not in readme_text
14+
assert "python -m" not in contributing_text
15+
16+
17+
def test_example_run_blocks_use_python3():
18+
legacy_python_pattern = re.compile(r"^\s*python\s+examples/.*$", re.MULTILINE)
19+
20+
for example_path in sorted(Path("examples").glob("*.py")):
21+
example_text = example_path.read_text(encoding="utf-8")
22+
assert not legacy_python_pattern.search(example_text)

0 commit comments

Comments
 (0)