Repository navigation
Avoid import of classes from another test file - #15381
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.
|
|
Some of the failures are unrelated but this looks related:
|
|
Darn. So, somehow the |
e53383e to
2f5bb61
Compare
|
OK, found the problem. Tests pass locally at least... |
|
|
||
| # Preserve the original REPRESENTATION_CLASSES dict so that importing | ||
| # the test file doesn't add a persistent test subclass (CustomGeodetic, etc.) | ||
| REPRESENTATION_CLASSES_ORIG = deepcopy(REPRESENTATION_CLASSES) |
There was a problem hiding this comment.
Should this be in setup_module to be consistent with teardown?
There was a problem hiding this comment.
I started that, but then I still need to define global variables, no? In the end, it seemed an unnecessary complication. But maybe I was overcomplicating things - how should this be done?
There was a problem hiding this comment.
Hmm, good point. I guess this is fine since pyinstaller is happy. Thanks for the clarification!
|
numpy dev and exotic arch failures should be unrelated though I expect the pyinstaller job to be green. |
It seems to have worked... |
|
Do you still need this import? from astropy.coordinates.tests.test_representation import ( # noqa: F401
setup_function,
teardown_function,
) |
These classes add to the representations dict, and the cleanup is messy. Better just to redefine the two representations that are needed. Similarly, importing setup_function and teardown_function is risky; here, actually teardown_module was needed.
2f5bb61 to
052d960
Compare
|
Oops, thanks for catching that... that import should go! Removed. |
|
Unfortunately, I don't think your patch work for "double run"? |
pllim
left a comment
There was a problem hiding this comment.
I think the failure in Python 3.10 in Parallel with all optional dependencies is related.
Here, use setup_class and teardown_class instead of teardown_module.
|
Darn. Cannot quite reproduce the failure locally, so am trying something fairly desparate -- put all the tests in a class and use |
These classes add to the representations dict, and the cleanup is messy. Better just to redefine the two representations that are needed.
Fixes the failures noted by @pllim in #14820 (comment)