Skip to content

Commit 04511a1

Browse files
Add architecture guard for example script syntax
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent e0b3525 commit 04511a1

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ This runs lint, format checks, compile checks, tests, and package build.
9292
- `tests/test_type_utils_usage.py` (type `__mro__` boundary centralization in `hyperbrowser/type_utils.py`),
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),
95-
- `tests/test_contributing_architecture_guard_listing.py` (`CONTRIBUTING.md` architecture-guard inventory completeness enforcement).
95+
- `tests/test_contributing_architecture_guard_listing.py` (`CONTRIBUTING.md` architecture-guard inventory completeness enforcement),
96+
- `tests/test_examples_syntax.py` (example script syntax guardrail).
9697

9798
## Code quality conventions
9899

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"tests/test_polling_loop_usage.py",
2323
"tests/test_core_type_helper_usage.py",
2424
"tests/test_contributing_architecture_guard_listing.py",
25+
"tests/test_examples_syntax.py",
2526
)
2627

2728

tests/test_examples_syntax.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import ast
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
pytestmark = pytest.mark.architecture
7+
8+
9+
def test_example_scripts_have_valid_python_syntax():
10+
example_files = sorted(Path("examples").glob("*.py"))
11+
assert example_files != []
12+
13+
for example_path in example_files:
14+
source = example_path.read_text(encoding="utf-8")
15+
ast.parse(source, filename=example_path.as_posix())

0 commit comments

Comments
 (0)