Skip to content

MNT: refactor tests to use cfradial1_sgp_dtree session fixture#347

Open
aladinor wants to merge 1 commit intoopenradar:mainfrom
aladinor:ref/use-cfradial1-sgp-fixture
Open

MNT: refactor tests to use cfradial1_sgp_dtree session fixture#347
aladinor wants to merge 1 commit intoopenradar:mainfrom
aladinor:ref/use-cfradial1-sgp-fixture

Conversation

@aladinor
Copy link
Copy Markdown
Member

Summary

  • Add cfradial1_sgp_dtree session fixture to conftest.py
  • Refactor 8 tests across test_util.py (6) and test_accessors.py (2) to use the shared fixture instead of inlining DATASETS.fetch("sample_sgp_data.nc") + open_cfradial1_datatree()
  • Net reduction: 76 lines removed

Closes #346

Test plan

  • All 128 tests in test_util.py + test_accessors.py pass
  • black + ruff clean

🤖 Generated with Claude Code

Add cfradial1_sgp_dtree session fixture to conftest.py and refactor
8 tests across test_util.py and test_accessors.py to use it instead
of inlining DATASETS.fetch + open_cfradial1_datatree.

Closes openradar#346
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.61%. Comparing base (0760557) to head (8642ed6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #347   +/-   ##
=======================================
  Coverage   93.61%   93.61%           
=======================================
  Files          27       27           
  Lines        5797     5797           
=======================================
  Hits         5427     5427           
  Misses        370      370           
Flag Coverage Δ
notebooktests 0.00% <ø> (?)
unittests 93.61% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@kmuehlbauer kmuehlbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aladinor Thanks! One suggestion here.

Comment thread tests/conftest.py
import xradar as xd

filename = DATASETS.fetch("sample_sgp_data.nc")
return xd.io.open_cfradial1_datatree(filename)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to just return the filename and open inside the test function? This would prevent from possible changes of the DataTree object during tests (as the .copy() in the tests below suggest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

REF: use cfradial1_sgp_dtree fixture in test_util.py and test_accessors.py

2 participants