Consider promoting the `_to_xp` test helper to a shared fixture
- Dominant language
- Python
- Stars
- 93
- Forks
- 92
- Avg merge
- 14h 44m
- Merged PRs (30d)
- 30
Description
`ccdproc/tests/test_blocks.py` has a small helper, `_to_xp(data)`, that wraps
`xp.asarray(data, device=xp_device)` to build a numpy reference array on
whatever backend/device `CCDPROC_ARRAY_LIBRARY` selects for the test run.
That same inline pattern appears dozens of times across `test_cosmicray.py`,
`test_rebin.py`, `test_nanfuncs.py`, `test_ccdmask.py`, `test_ccdproc.py`
and `test_combiner.py`, but `_to_xp` is the only place that names it, and it
currently lives only in `test_blocks.py`.
Once a second test module needs this "build an array on the active backend
and device" helper, consider promoting it to a shared fixture/helper in
`ccdproc/conftest.py` (or `ccdproc/pytest_fixtures.py`) instead of
duplicating it. Came out of review on #1009.
— Written by Claude at @mwcraig's direction.
Contributor guide
Research direction
Start with ccdproc/tests/test_blocks.py and its _to_xp helper, then inspect the repeated inline pattern in test_cosmicray.py, test_rebin.py, test_nanfuncs.py, test_ccdmask.py, test_ccdproc.py, and test_combiner.py. Decide whether ccdproc/conftest.py or ccdproc/pytest_fixtures.py is the appropriate shared location, replace the duplications, and run the affected test modules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 76/100