File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " Running all test cases across the project..."
2
+ echo " Running all test cases across the project with coverage analysis ..."
3
3
4
4
# Initialize a failure counter
5
5
failure_count=0
@@ -10,10 +10,20 @@ excluded_dirs="document_classifier functional_tests"
10
10
# Find all test files except those in excluded directories
11
11
test_files=$( find . -type f -name " test_*.py" | grep -Ev " $( echo $excluded_dirs | sed ' s/ /|/g' ) " )
12
12
13
- # Run each test file
13
+ coverage erase # Clear any existing coverage data
14
+
15
+ # Setup .coveragerc configuration to include all Python files
16
+ echo " [run]
17
+ source = .
18
+ include = */*.py
19
+
20
+ [report]
21
+ show_missing = True" > .coveragerc
22
+
23
+ # Run each test file with coverage (without generating report yet)
14
24
for test_file in $test_files ; do
15
25
echo " Running $test_file ..."
16
- pytest " $test_file "
26
+ coverage run --append -m pytest " $test_file " # Collect coverage data
17
27
18
28
# Check the exit status of pytest
19
29
if [ $? -ne 0 ]; then
@@ -22,10 +32,11 @@ for test_file in $test_files; do
22
32
fi
23
33
done
24
34
25
- # Report the results
35
+ # Report the results without generating the coverage report
26
36
if [ $failure_count -ne 0 ]; then
27
- echo " $failure_count test(s) failed."
37
+ echo " $failure_count test(s) failed. Refer to the terminal output for details. "
28
38
exit 1
29
39
else
30
40
echo " All tests passed successfully!"
31
- fi
41
+ echo " Coverage data collected. Coverage report will be generated separately."
42
+ fi
You can’t perform that action at this time.
0 commit comments