MNT: refactor tests to use cfradial1_sgp_dtree session fixture#347
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #347 +/- ##
=======================================
Coverage 94.15% 94.15%
=======================================
Files 29 29
Lines 6416 6416
=======================================
Hits 6041 6041
Misses 375 375
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kmuehlbauer
left a comment
There was a problem hiding this comment.
@aladinor Thanks! One suggestion here.
|
@aladinor Looks like this is almost done? Anything further needed here? |
|
Ups. Totally forgot this. Let me address your comment @kmuehlbauer |
Address @kmuehlbauer's review on openradar#347. Returning the opened DataTree from a session-scoped fixture forced tests that mutate the tree (test_get_sweep_keys, test_map_over_sweeps_non_sweep_nodes) to call .copy() defensively, and made cross-test mutation a possible source of flakes. Return the filename instead and let each test open its own DataTree.
|
@kmuehlbauer Good call — applied in c8dca43. The fixture now returns the filename and each test opens its own DataTree, dropping the defensive |
Closes openradar#346. Add cfradial1_sgp_file session fixture in conftest.py that returns the filename for sample_sgp_data.nc. Refactor 8 tests in test_util.py and test_accessors.py to use the fixture instead of inlining DATASETS.fetch + open_cfradial1_datatree. Per @kmuehlbauer's review: the fixture returns the filename (not the opened DataTree) so each test opens its own tree, avoiding cross-test mutation that previously required defensive .copy() calls. Tests covered: - test_get_sweep_keys - test_apply_to_sweeps - test_apply_to_sweeps_inherit_false - test_apply_to_sweeps_inherit_via_map_over_sweeps - test_apply_to_volume - test_map_over_sweeps_decorator_dummy_function - test_map_over_sweeps_apply_dummy_function - test_map_over_sweeps_non_sweep_nodes 132 tests in test_util.py + test_accessors.py pass; black + ruff clean.
c8dca43 to
c001657
Compare
Summary
cfradial1_sgp_dtreesession fixture toconftest.pytest_util.py(6) andtest_accessors.py(2) to use the shared fixture instead of inliningDATASETS.fetch("sample_sgp_data.nc")+open_cfradial1_datatree()Closes #346
Test plan
test_util.py+test_accessors.pypass🤖 Generated with Claude Code