Repository navigation
TST: avoid NameErrors in a couple tests that couldn't be run in isolation - #17559
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 |
NameErrors in a couple tests that couldn't be run in isolation
| assert docs[-1][iread : iread + 3] != "Yes" | ||
| # now test it's updated | ||
| docs = EmptyData.read.__doc__.split("\n") | ||
| ihd = [i for i, s in enumerate(docs) if ("Format" in s)][0] |
There was a problem hiding this comment.
I think a slightly larger factor is called for here. The above test block could be dedented from the context and then some of the index creators can be moved out of the conditional block using the solution here.
There was a problem hiding this comment.
The above test block could be dedented from the context
I'm not sure that's the case; without looking to deeply into how this context works exactly, it seems to me that the only difference between line 346 and line 355 is that the former happens within the context, while the latter doesn't.
There was a problem hiding this comment.
Hm. you're right. It happens at context exit.
|
I see that you applied "affects-dev" label but if it only affects development version, why the backport? |
|
Anyways, I will remove that label. Thanks, all! |
…that couldn't be run in isolation
…559-on-v7.0.x Backport PR #17559 on branch v7.0.x (TST: avoid `NameError`s in a couple tests that couldn't be run in isolation)
|
I guess I had a slightly wrong interpretation of that label: I thought it meant "doesn't affect end users". Anyway, thanks for fixing my mistake ! |
|
No worries. It was added years ago by |
Description
Fixes #17558