Skip to content

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
19.0from
fix-443-gis-export-no-data-test
Open

gonzalesedwin1123 wants to merge 2 commits into
19.0from
fix-443-gis-export-no-data-test

Conversation

@gonzalesedwin1123

Copy link
Copy Markdown
Member

Part of #443 (weekly ci-full red). Test-only; 1 test in the SP-MIS stack.

Cause

TestExportService.test_export_no_data_raises_error deactivates only its own two reports and two geofences, then calls export_geopackage(layer_ids=[], include_geofences=True). An empty layer_ids takes the "all active reports" branch, and _collect_layers appends a report even with zero features, so the No data available guard fires only when there are no active reports at all. spp_mis_demo_v2/data/demo_gis_reports.xml ships four spp.gis.report records under data (not demo), so in the SP-MIS stack they were collected (log: Collected report: MIS_DEMO_BENEFICIARY_DIST with 0 features ×4) and the assertion failed with ValueError 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

  • Stack run -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).
  • Module suite green (see CI). All pre-commit hooks pass.

spp_api_v2_gis 19.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_geopackage should raise when every collected layer is empty. Behaviour change, tracked in the #443 research follow-ups.

…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

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.91%. Comparing base (1a3c591) to head (9c3e941).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             19.0     #545   +/-   ##
=======================================
  Coverage   76.91%   76.91%           
=======================================
  Files         704      704           
  Lines       45774    45774           
=======================================
  Hits        35205    35205           
  Misses      10569    10569           
Flag Coverage Δ
spp_api_v2_gis 74.60% <ø> (ø)
spp_base_common 91.07% <ø> (ø)
spp_dci_demo 94.28% <ø> (ø)
spp_mis_demo_v2 70.41% <ø> (ø)
spp_programs 67.58% <ø> (ø)
spp_registry 89.00% <ø> (ø)
spp_security 69.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gonzalesedwin1123

Copy link
Copy Markdown
Member Author

Full-stack evidence: SP-MIS ci-full dispatched on this branch (run 35566249958) vs the 2026-09-20 weekly baseline (run 35499069639).

@gonzalesedwin1123
gonzalesedwin1123 marked this pull request as ready for review September 21, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant