astropy / astropy/ccdproc

Consider promoting the `_to_xp` test helper to a shared fixture

Open Beginner friendly
#1,015 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.