Repository navigation
BUG: ensure custom_ucd_coord_meta_mapping context manager performs a (correct) cleanup - #17749
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
custom_ucd_coord_meta_mapping context manager performs a (correct) cleanup
080bf9d to
b864258
Compare
|
|
||
| def test_custom_coord_type_from_ctype_nested(): | ||
| from astropy.visualization.wcsaxes.wcsapi import ( | ||
| CUSTOM_UCD_COORD_META_MAPPING as global_state, # noqa: N811 |
There was a problem hiding this comment.
N811 is constant-imported-as-non-constant. I decided to ignore this rule here since CUSTOM_UCD_COORD_META_MAPPING is by no means a constant (hence the bugs and fixes), despite what the case suggests.
| CUSTOM_UCD_COORD_META_MAPPING as global_state, # noqa: N811 | |
| CUSTOM_UCD_COORD_META_MAPPING as global_state, # noqa: N811 |
b864258 to
d2bded8
Compare
mhvk
left a comment
There was a problem hiding this comment.
Looks good to me but obviously should have review from wcs team.
d2bded8 to
baec449
Compare
| from .frame import EllipticalFrame, RectangularFrame, RectangularFrame1D | ||
| from .transforms import CurvedTransform | ||
|
|
||
| if TYPE_CHECKING: |
There was a problem hiding this comment.
Is the typing stuff really necessary here to fix the failures?
There was a problem hiding this comment.
I wonder if you could simplify this patch to just the needed changes so it is easier to backport... 😬
There was a problem hiding this comment.
I wanted to prove a point and tried applying the patch as is to v7.0.x and... found that it is indeed only trivial to backport without this part... so, as much as it saddens me, I'll remove it now. Thanks for pointing it out !
There was a problem hiding this comment.
Thank you for your understanding!
…(correct) cleanup
baec449 to
5973dcf
Compare
|
@mhvk , this actually touches visualization.wcsaxes more than it does actual wcs . If we don't hear back from @astrofrog , @Cadair , or @larrybradley , does your approval still stand? If so, we can probably just merge it in a week or so regardless. |
mhvk
left a comment
There was a problem hiding this comment.
yes, I'm fine with my approval being good enough - the actual code changes are logical and good (and I like the test changes too!).
|
Merged. Thanks, all! |
…` context manager performs a (correct) cleanup
…749-on-v7.0.x Backport PR #17749 on branch v7.0.x (BUG: ensure `custom_ucd_coord_meta_mapping` context manager performs a (correct) cleanup)
Description
This fixes test pollution seen in two tests (partially address #17745).
Follow up to #16347.
Reprod:
There were a couple defects in this context managers:
I augmented the affected tests to make them fail on their own if the global state is changed.