Skip to content

Commit 0fcbff4

Browse files
author
Harmanpreet Kaur
committed
pass even if test filesa r not present
1 parent f31bf82 commit 0fcbff4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,23 @@ jobs:
2727
pip install -r src/backend/requirements.txt
2828
pip install pytest-cov
2929
30+
- name: Check if test files exist
31+
id: check_tests
32+
run: |
33+
if [ -z "$(find src -type f -name 'test_*.py')" ]; then
34+
echo "No test files found, skipping tests."
35+
echo "skip_tests=true" >> $GITHUB_ENV
36+
else
37+
echo "Test files found, running tests."
38+
echo "skip_tests=false" >> $GITHUB_ENV
39+
fi
40+
3041
- name: Run tests with coverage
42+
if: env.skip_tests == 'false'
3143
run: |
3244
pytest --cov=. --cov-report=term-missing --cov-report=xml
33-
34-
45+
46+
- name: Skip coverage report if no tests
47+
if: env.skip_tests == 'true'
48+
run: |
49+
echo "Skipping coverage report because no tests were found."

0 commit comments

Comments
 (0)