Ensure Masked test robustness when tests are run in parallel#15327
Ensure Masked test robustness when tests are run in parallel#15327mhvk merged 1 commit intoastropy:mainfrom
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.
|
|
Oops, #15326 preceded me! I'll rebase keeping just the single new commit (no need to backport then either). |
747a49a to
0693591
Compare
|
Darn, of course now I need to rebase again when #15326 is merged. Silly me. |
0693591 to
0c61647
Compare
|
Rebased... |
|
Who should review the content here? @nstarman ? |
0c61647 to
7d4c799
Compare
nstarman
left a comment
There was a problem hiding this comment.
All these tests look very reasonable and should prevent errors when run in parallel.
| # First check setup_class (or previous use) defined a cache entry. | ||
| mcls = Masked._masked_classes[type(self.a)] | ||
| # Next check this is what one gets now. | ||
| MQ = Masked(Quantity) |
There was a problem hiding this comment.
Why does this line not use self.MQ like the other tests? I must have missed some earlier discussions?
There was a problem hiding this comment.
Yes, here I want to test that if I try to create MQ again that I don't get a new version (e.g., in principle, the caching could be broken, and every time one calls it, it creates a new class and just caches that one).
…re run in parallel
|
Oops, I missed that without the original commit to actually fix a bug, this further refactoring and cleaning up really does not need to be backported anymore. I closed the backport PR and changed the labels here. Hopefully that's enough! |
This pull request is to address the irregular test failures reported in #15316, where it was noted that occasionally,
test_masked.py::TestMaskedQuantityInitialization::test_masked_quantity_gettingfailed withKeyError. The test assumed that aMaskedQuantityhad been used before, which is not true if this test is run first.In the PR, the first commit fixes it by explicitly defining the
MaskedQuantityinsetup_class; the second commit refactors the whole class a bit, to make it a bit more logical. They should be kept separate.Fixes #15316