Skip to content

Commit 8f128d4

Browse files
Enforce sync/async naming convention for examples
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent acbcb4f commit 8f128d4

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ This runs lint, format checks, compile checks, tests, and package build.
8585
- `tests/test_docs_python3_commands.py` (`README`/`CONTRIBUTING`/examples python3 command consistency enforcement),
8686
- `tests/test_example_run_instructions.py` (example run-instruction consistency enforcement),
8787
- `tests/test_example_sync_async_parity.py` (sync/async example parity enforcement),
88+
- `tests/test_examples_naming_convention.py` (example sync/async prefix naming enforcement),
8889
- `tests/test_examples_syntax.py` (example script syntax guardrail),
8990
- `tests/test_guardrail_ast_utils.py` (shared AST guard utility contract),
9091
- `tests/test_makefile_quality_targets.py` (Makefile quality-gate target enforcement),

tests/test_architecture_marker_usage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"tests/test_readme_examples_listing.py",
2828
"tests/test_examples_syntax.py",
2929
"tests/test_docs_python3_commands.py",
30+
"tests/test_examples_naming_convention.py",
3031
"tests/test_example_sync_async_parity.py",
3132
"tests/test_example_run_instructions.py",
3233
"tests/test_computer_action_endpoint_helper_usage.py",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import re
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
pytestmark = pytest.mark.architecture
7+
8+
9+
def test_example_scripts_follow_sync_async_prefix_naming():
10+
example_files = sorted(Path("examples").glob("*.py"))
11+
assert example_files != []
12+
13+
pattern = re.compile(r"^(sync|async)_[a-z0-9_]+\.py$")
14+
for example_path in example_files:
15+
assert pattern.fullmatch(example_path.name)

0 commit comments

Comments
 (0)