Private
Public Access
fix(sandbox): audit --tests-dir bypass EXCLUDE_DIRS; probe path in regression test
This commit is contained in:
@@ -48,10 +48,10 @@ PATTERNS = [
|
||||
EXCLUDE_DIRS = {"artifacts", "logs", "__pycache__", "snapshots"}
|
||||
|
||||
|
||||
def find_violations(tests_dir: Path) -> list[tuple[Path, int, str]]:
|
||||
def find_violations(tests_dir: Path, apply_excludes: bool = True) -> list[tuple[Path, int, str]]:
|
||||
violations: list[tuple[Path, int, str]] = []
|
||||
for test_file in tests_dir.rglob("test_*.py"):
|
||||
if any(excluded in test_file.parts for excluded in EXCLUDE_DIRS):
|
||||
if apply_excludes and any(excluded in test_file.parts for excluded in EXCLUDE_DIRS):
|
||||
continue
|
||||
try:
|
||||
content = test_file.read_text(encoding="utf-8")
|
||||
@@ -80,7 +80,8 @@ def main() -> int:
|
||||
if not tests_dir.exists():
|
||||
print(f"Tests dir not found: {tests_dir}", file=sys.stderr)
|
||||
return 1
|
||||
violations = find_violations(tests_dir)
|
||||
apply_excludes = (Path(args.tests_dir).resolve() == repo_root / "tests")
|
||||
violations = find_violations(tests_dir, apply_excludes=apply_excludes)
|
||||
|
||||
if args.json:
|
||||
payload = {
|
||||
|
||||
Reference in New Issue
Block a user