Skip to content

Commit 0c2c8c6

Browse files
author
Your Name
committed
Separation of coverage Report_latest2
1 parent 5b8576f commit 0c2c8c6

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.coveragerc

Lines changed: 0 additions & 6 deletions
This file was deleted.

init.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
echo "Running all test cases across the project..."
2+
echo "Running all test cases across the project with coverage analysis..."
33

44
# Initialize a failure counter
55
failure_count=0
@@ -10,10 +10,20 @@ excluded_dirs="document_classifier functional_tests"
1010
# Find all test files except those in excluded directories
1111
test_files=$(find . -type f -name "test_*.py" | grep -Ev "$(echo $excluded_dirs | sed 's/ /|/g')")
1212

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)
1424
for test_file in $test_files; do
1525
echo "Running $test_file..."
16-
pytest "$test_file"
26+
coverage run --append -m pytest "$test_file" # Collect coverage data
1727

1828
# Check the exit status of pytest
1929
if [ $? -ne 0 ]; then
@@ -22,10 +32,11 @@ for test_file in $test_files; do
2232
fi
2333
done
2434

25-
# Report the results
35+
# Report the results without generating the coverage report
2636
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."
2838
exit 1
2939
else
3040
echo "All tests passed successfully!"
31-
fi
41+
echo "Coverage data collected. Coverage report will be generated separately."
42+
fi

0 commit comments

Comments
 (0)