test(spp_api_v2_gis): deactivate every report and geofence before asserting the no-data export error (#443) - #545
Open
gonzalesedwin1123 wants to merge 2 commits into
Open
gonzalesedwin1123 wants to merge 2 commits into
gonzalesedwin1123 wants to merge 2 commits into
Conversation
…erting the no-data export error An empty layer_ids means every active spp.gis.report is collected, and a report with zero features still counts as a layer. The test deactivated only its own two reports and geofences, so a demo module in the same database (spp_mis_demo_v2 ships four report records as data) supplied layers and the expected ValueError never came. Refs #443
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #545 +/- ##
=======================================
Coverage 76.91% 76.91%
=======================================
Files 704 704
Lines 45774 45774
=======================================
Hits 35205 35205
Misses 10569 10569
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Member
Author
|
Full-stack evidence: SP-MIS
|
gonzalesedwin1123
marked this pull request as ready for review
September 21, 2026 06:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #443 (weekly ci-full red). Test-only; 1 test in the SP-MIS stack.
Cause
TestExportService.test_export_no_data_raises_errordeactivates only its own two reports and two geofences, then callsexport_geopackage(layer_ids=[], include_geofences=True). An emptylayer_idstakes the "all active reports" branch, and_collect_layersappends a report even with zero features, so theNo data availableguard fires only when there are no active reports at all.spp_mis_demo_v2/data/demo_gis_reports.xmlships fourspp.gis.reportrecords underdata(notdemo), so in the SP-MIS stack they were collected (log:Collected report: MIS_DEMO_BENEFICIARY_DIST with 0 features×4) and the assertion failed withValueError not raised.The test now deactivates every report and geofence in the database first (rolled back with the transaction), keeping the "all reports" branch under test.
Evidence
-i spp_api_v2_gis,spp_mis_demo_v2 --test-tags /spp_api_v2_gis:TestExportService:0 failed, 0 error(s) of 23 tests(red in the 2026-09-20 weekly run).spp_api_v2_gis19.0.2.0.1 → 19.0.2.0.2 + HISTORY. README/index.html left for CI's generator.Noted, not changed
A layer with zero features counts as data; arguably
export_geopackageshould raise when every collected layer is empty. Behaviour change, tracked in the #443 research follow-ups.