forked from Rockachopa/Timmy-time-dashboard
chore: checkpoint local wip for issue 892
This commit is contained in:
@@ -9,11 +9,10 @@ This script runs before commits to catch issues early:
|
||||
- Syntax errors in test files
|
||||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import ast
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def check_imports():
|
||||
@@ -70,7 +69,7 @@ def check_test_syntax():
|
||||
|
||||
for test_file in tests_dir.rglob("test_*.py"):
|
||||
try:
|
||||
with open(test_file, "r") as f:
|
||||
with open(test_file) as f:
|
||||
ast.parse(f.read())
|
||||
print(f"✓ {test_file.relative_to(tests_dir.parent)} has valid syntax")
|
||||
except SyntaxError as e:
|
||||
@@ -86,7 +85,7 @@ def check_platform_specific_tests():
|
||||
# Check for hardcoded /Users/ paths in tests
|
||||
tests_dir = Path("tests").resolve()
|
||||
for test_file in tests_dir.rglob("test_*.py"):
|
||||
with open(test_file, "r") as f:
|
||||
with open(test_file) as f:
|
||||
content = f.read()
|
||||
if 'startswith("/Users/")' in content:
|
||||
issues.append(
|
||||
@@ -110,7 +109,7 @@ def check_docker_availability():
|
||||
|
||||
if docker_test_files:
|
||||
for test_file in docker_test_files:
|
||||
with open(test_file, "r") as f:
|
||||
with open(test_file) as f:
|
||||
content = f.read()
|
||||
has_skipif = "@pytest.mark.skipif" in content or "pytestmark = pytest.mark.skipif" in content
|
||||
if not has_skipif and "docker" in content.lower():
|
||||
|
||||
Reference in New Issue
Block a user