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
mapping.py previously had warnings.filterwarnings("ignore") at module scope (line 26), which suppressed ALL Python warnings for the entire process. This was fixed by:
Removing the global suppression
Adding targeted warnings.catch_warnings() inside _load_priogrid() scoped to the CRS centroid warning only
This fix resolved C-18 (global warning suppression) and D-03 (warning suppression disagreement).
No test verifies this fix. If someone re-adds warnings.filterwarnings("ignore") to mapping.py — a common "fix" when noisy warnings appear — no test detects it. The global suppression returns, hiding geopandas deprecation warnings, shapely geometry errors, numpy overflow warnings, and all other correctness signals.
This was identified by the falsification campaign (Claim 3.3, FALSIFIED).
Why now
This is the fastest test to write (~15 minutes) and protects against the most likely regression: a developer encountering a noisy warning and adding a global filter to silence it.
Requirements
Test: test_no_global_warning_suppression
Setup:
Import warnings and views_postprocessing.unfao.mapping.mapping (the conftest intercept handles shapefile loading).
Assert:
No entry in warnings.filters has the pattern ("ignore", None, <Warning>, None, 0) — which is what warnings.filterwarnings("ignore") adds. Specifically:
Assert:
The specific CRS centroid warning IS suppressed (targeted suppression works):
importwarningswithwarnings.catch_warnings(record=True) asw:
warnings.simplefilter("always")
# Trigger centroid calculation on geographic CRSmapper.priogrid_gdf["geometry"].centroidcrs_warnings= [xforxinwif"geographic CRS"instr(x.message)]
# The targeted suppression in _load_priogrid catches this during loading,# but calling .centroid again outside the suppression context should show# the warning is NOT globally suppressed — it fires here.
Actually, a simpler approach: verify that after importing mapping.py, a non-centroid warning (e.g., a UserWarning) IS visible — proving global suppression is not active.
Test: test_non_centroid_warnings_are_visible
importwarningswithwarnings.catch_warnings(record=True) asw:
warnings.simplefilter("always")
warnings.warn("test warning", UserWarning)
assertlen(w) ==1, "UserWarning should be visible — global suppression must not be active"
Acceptance criteria
test_no_global_warning_suppression passes
test_non_centroid_warnings_are_visible passes
Re-adding warnings.filterwarnings("ignore") to mapping.py causes at least one test to fail
Tests are in tests/test_regression.py
References
Falsification campaign Claim 3.3 (FALSIFIED)
Test stub: tests/test_falsification_campaign_3_3.py
Context
mapping.pypreviously hadwarnings.filterwarnings("ignore")at module scope (line 26), which suppressed ALL Python warnings for the entire process. This was fixed by:warnings.catch_warnings()inside_load_priogrid()scoped to the CRS centroid warning onlyThis fix resolved C-18 (global warning suppression) and D-03 (warning suppression disagreement).
No test verifies this fix. If someone re-adds
warnings.filterwarnings("ignore")to mapping.py — a common "fix" when noisy warnings appear — no test detects it. The global suppression returns, hiding geopandas deprecation warnings, shapely geometry errors, numpy overflow warnings, and all other correctness signals.This was identified by the falsification campaign (Claim 3.3, FALSIFIED).
Why now
This is the fastest test to write (~15 minutes) and protects against the most likely regression: a developer encountering a noisy warning and adding a global filter to silence it.
Requirements
Test:
test_no_global_warning_suppressionSetup:
Import
warningsandviews_postprocessing.unfao.mapping.mapping(the conftest intercept handles shapefile loading).Assert:
No entry in
warnings.filtershas the pattern("ignore", None, <Warning>, None, 0)— which is whatwarnings.filterwarnings("ignore")adds. Specifically:Test:
test_centroid_crs_warning_is_suppressedAssert:
The specific CRS centroid warning IS suppressed (targeted suppression works):
Actually, a simpler approach: verify that after importing mapping.py, a non-centroid warning (e.g., a
UserWarning) IS visible — proving global suppression is not active.Test:
test_non_centroid_warnings_are_visibleAcceptance criteria
test_no_global_warning_suppressionpassestest_non_centroid_warnings_are_visiblepasseswarnings.filterwarnings("ignore")to mapping.py causes at least one test to failtests/test_regression.pyReferences
tests/test_falsification_campaign_3_3.py