Skip to content

Commit b11c30b

Browse files
reeshika-hclaude
andcommitted
Fix: keep husky hooks working without pytest-html
The dev requirements no longer include pytest-html, but the pre-push and test-runner hooks ran pytest --html. Pass --html only when pytest-html is installed so the hooks work either way. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 21a2576 commit b11c30b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎.husky/hooks/test-runner.sh‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ fi
2020

2121
# Run tests
2222
echo " - Running tests..."
23-
if pytest --html=tests/report/test-report.html; then
23+
# HTML report only when pytest-html is installed (it is optional)
24+
HTML_ARGS=""
25+
if python -c "import pytest_html" 2>/dev/null; then
26+
HTML_ARGS="--html=tests/report/test-report.html"
27+
fi
28+
if pytest $HTML_ARGS; then
2429
echo " ✅ All tests passed"
2530
else
2631
echo " ❌ Tests failed. Please fix before pushing."

‎.husky/pre-push‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ fi
1010

1111
# Run tests to ensure code quality
1212
echo "🧪 Running tests..."
13-
if ! pytest --html=tests/report/test-report.html; then
13+
# HTML report only when pytest-html is installed (it is optional)
14+
HTML_ARGS=""
15+
if python -c "import pytest_html" 2>/dev/null; then
16+
HTML_ARGS="--html=tests/report/test-report.html"
17+
fi
18+
if ! pytest $HTML_ARGS; then
1419
echo "❌ Tests failed. Please fix before pushing."
1520
exit 1
1621
fi

0 commit comments

Comments
 (0)