New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor test_connect
for new test suite
#12191
Conversation
Hello @nstarman 👋! It looks like you've made some changes in your pull request, so I've checked the code again for style. There are no PEP8 style issues with this pull request - thanks! 🎉 Comment last updated at 2021-09-24 21:06:23 UTC |
ba21596
to
5f1a7c6
Compare
5f1a7c6
to
312a7f7
Compare
312a7f7
to
2b4ffb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. The one thing I feel is missing is good docstrings for the Mixin
test classes, on what subclasses are supposed to define (the cosmo
fixture?).
One thing I wondered was whether you are still sure no test is run twice - a disadvantage of this fairly complicated structure is that this is no longer obvious...
Anyway, I think the goal here is good and it looks all in order, so approving.
@@ -264,7 +264,7 @@ def __new__(cls, *args, **kwargs): | |||
|
|||
return self | |||
|
|||
def __init__(self, *args, name=None, meta=None, **kwargs): | |||
def __init__(self, name=None, meta=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good not to eat arguments without warning or error!
|
||
class TestReadWriteCosmology: | ||
@pytest.fixture(scope="class", autouse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know about this one. Out of curiosity, any reason not to use setup_class
and teardown_class
? Are you avoiding those to avoid forcing super()
calls when actually used as a mixin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's mostly that.
And since these are "mixin" it helps keep the class orthogonal.
""" | ||
Test writing from an instance and reading from that class. | ||
This requires partial information. | ||
|
||
.. todo:: | ||
|
||
generalize over all save formats for this test. | ||
remove when fix method in super |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is addressed to yourself, so perhaps not relevant, but I would have no idea what it meant!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah. I haven't figured out how to do this in general. Modifying a dict is different than a table is different than a Model. I want to test reading from a class and having that class fill in missing information, but I need to figure out how to delete that information. So currently this test only runs on dicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not dire, which is why I'm leaving in a TODO, but it would be best to show the information inference works irrespective of the format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have a solution... you'll see it soonish 😆
A good point! I'll add some documentation on that.
I've tested this pretty thoroughly in other code. Long story short: pytest only runs code starting with |
2b4ffb5
to
e1c445d
Compare
Provides mixins for TestCosmology to test the descriptors Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
e1c445d
to
2160c2b
Compare
Provides mixins for TestCosmology to test the descriptors.
Now every cosmology will test that it can I/O.
Also the classes in
connect.py
have some extra tests built upon the more general tests that each cosmology runs.Signed-off-by: Nathaniel Starkman (@nstarman) nstarkman@protonmail.com
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CI
label.no-changelog-entry-needed
label. If this is a manual backport, use theskip-changelog-checks
label unless special changelog handling is necessary.astropy-bot
check might be missing; do not let the green checkmark fool you.backport-X.Y.x
label(s) before merge.