You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Configure SonarCloud integration for Python coverage
- Added XML coverage report generation to pytest.ini
- Updated Makefile coverage target to generate coverage.xml
- Modified unit.sh to run 'coverage' instead of 'test' for Python projects
- Configured sonar-scanner.properties with Python test paths and coverage:
- Added src/asyncapigenerator/tests to sonar.tests
- Added src/**/tests/ pattern to test inclusions
- Enabled sonar.python.coverage.reportPaths
- Added Python tests to coverage exclusions
- Documented SonarCloud requirements in TESTING_PLAN.md
- Added clean-test target to remove coverage.xml
This fixes SonarCloud showing 0% coverage for Python projects.
-`src/asyncapigenerator/pytest.ini` - Added XML coverage report
89
+
-`src/asyncapigenerator/Makefile` - Updated coverage target and clean-test
90
+
-`scripts/tests/unit.sh` - Run coverage instead of test
91
+
-`scripts/config/sonar-scanner.properties` - Added Python test paths and coverage configuration
92
+
-**Rationale**: SonarCloud was showing 0% coverage because pytest wasn't generating XML coverage reports and sonar-scanner wasn't configured to find Python tests/coverage
93
+
-**Status**: Python coverage should now be reported to SonarCloud on next CI run
94
+
73
95
### 2025-11-04 13:02 GMT - Fixed Timestamps and Updated Instructions
74
96
75
97
-**Author**: GitHub Copilot
@@ -777,11 +799,11 @@ cd "$(git rev-parse --show-toplevel)"
777
799
# Python projects
778
800
echo"Setting up and running asyncapigenerator tests..."
779
801
make -C ./src/asyncapigenerator install-dev
780
-
make -C ./src/asyncapigenerator test
802
+
make -C ./src/asyncapigenerator coverage # Use coverage to generate coverage.xml for SonarCloud
781
803
782
804
echo"Setting up and running cloudeventjekylldocs tests..."
783
805
make -C ./src/cloudeventjekylldocs install-dev
784
-
make -C ./src/cloudeventjekylldocs test
806
+
make -C ./src/cloudeventjekylldocs coverage # Use coverage to generate coverage.xml for SonarCloud
785
807
786
808
# TypeScript/JavaScript projects (npm workspace)
787
809
npm ci
@@ -811,9 +833,46 @@ The GitHub Actions workflow (`.github/workflows/stage-2-test.yaml`):
811
833
812
834
- Python projects must have `install-dev` target in their Makefile
813
835
- Python projects must have `requirements-dev.txt` with test dependencies
836
+
-**Python projects must have `coverage` target that generates `coverage.xml`** for SonarCloud
814
837
- Tests must run quickly (timeout is 5 minutes for unit tests)
815
-
- Coverage reports should be in `.reports/` directory
816
-
- Python coverage should use pytest-cov format compatible with lcov-result-merger
838
+
- Coverage reports should be in `.reports/` directory for TypeScript, in project root for Python
839
+
- Python coverage must generate XML format: `pytest --cov=. --cov-report=xml:coverage.xml`
840
+
841
+
### SonarCloud Integration
842
+
843
+
**For Python Projects**: SonarCloud requires XML coverage reports. Ensure:
0 commit comments