Skip to content

Commit c191147

Browse files
Auto-validate architecture guard module inventory
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 4543202 commit c191147

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_architecture_marker_usage.py

Lines changed: 12 additions & 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_readme_examples_listing.py",
2526
"tests/test_examples_syntax.py",
2627
"tests/test_docs_python3_commands.py",
2728
"tests/test_example_sync_async_parity.py",
@@ -35,3 +36,14 @@ def test_architecture_guard_modules_are_marked():
3536
for module_path in ARCHITECTURE_GUARD_MODULES:
3637
module_text = Path(module_path).read_text(encoding="utf-8")
3738
assert "pytestmark = pytest.mark.architecture" in module_text
39+
40+
41+
def test_architecture_guard_module_list_stays_in_sync_with_marker_files():
42+
discovered_modules: list[str] = []
43+
for module_path in sorted(Path("tests").glob("test_*.py")):
44+
module_text = module_path.read_text(encoding="utf-8")
45+
if "pytestmark = pytest.mark.architecture" not in module_text:
46+
continue
47+
discovered_modules.append(module_path.as_posix())
48+
49+
assert sorted(ARCHITECTURE_GUARD_MODULES) == discovered_modules

0 commit comments

Comments
 (0)