Fix_issue_2239: Nasa Exoplanet Archive query_object method suddenly produces InvalidTableError#2264
Conversation
|
Hello @rickynilsson! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-03-04 00:40:02 UTC |
bsipocz
left a comment
There was a problem hiding this comment.
I'm pretty sure that the test failure is coming from the URL assumption in the mock setup, if you test it locally it should fail there, too, not just for old versions.
|
|
||
| @class_or_instance | ||
| def query_aliases(self, object_name, *, cache=None): | ||
| def query_aliases(self, object_name): |
There was a problem hiding this comment.
why remove cache? If remove, clear out the docstring, too
There was a problem hiding this comment.
Wasn't thinking, will add it back.
Codecov Report
@@ Coverage Diff @@
## main #2264 +/- ##
==========================================
- Coverage 63.10% 62.98% -0.12%
==========================================
Files 131 131
Lines 17040 17059 +19
==========================================
- Hits 10753 10745 -8
- Misses 6287 6314 +27
Continue to review full report at Codecov.
|
bsipocz
left a comment
There was a problem hiding this comment.
This fix needs to be mentioned in the changelog as the bug was reported by users. (And also add a mention of the API change for the removed keyword).
Other than the minor comments I left in the review, there is one remote test failing, maybe we could test not for the exact number of aliases but that there are e.g. more than 10?
And if you run the remote test, they would also reveal some docs example inconsistencies. For some of those, e.g. where we expect changes as the upstream database grows, I would suggest to use # doctest: +IGNORE_OUTPUT.
| "aliastable", objname=object_name.strip(), cache=cache, format="csv" | ||
| )["aliasdis"] | ||
| ) | ||
| url = requests.get("https://exoplanetarchive.ipac.caltech.edu/cgi-bin/Lookup/nph-aliaslookup.py?objname="+object_name) |
There was a problem hiding this comment.
As you added the base URL for the lookup to the config, please us it from there.
|
|
||
| def test_regularize_object_name(patch_get): | ||
| NasaExoplanetArchiveMock = NasaExoplanetArchiveClass() | ||
| # def test_regularize_object_name(patch_get): |
There was a problem hiding this comment.
Please either uncomment or if the regularize keyword is removed, then remove this test, too.
| @deprecated(since="v0.4.1", alternative="query_object") | ||
| @deprecated_renamed_argument(["show_progress", "table_path"], | ||
| [None, None], "v0.4.1", arg_in_kwargs=True) | ||
| def query_star(self, host_name, cache=None, regularize=True, **criteria): |
There was a problem hiding this comment.
This API change needs to be mentioned in the changelog
|
@bsipocz - I fixed up the testing and other things you mentioned, but seems codecov isn't happy. Any suggested tests I could add? I actually am not quite sure why the coverage isn't higher -- the tests should be running most of the added code. |
|
@rickynilsson - I'll need to look into this more carefully to suggest actual code changes, but at first glance, it seems that the mock testing is not actually running anything from the real method from the module, but only the mock function defined in the test, and that triggers the decrease in the coverage number. |
|
@rickynilsson - do you plan to add some extra test coverage here as part of the PR, or we should rather go ahead and merge and add more tests in a follow-up? Before merging: doc examples should be fixed (if you run |
|
I should probably just make a final push on this to get the necessary mock tests in place. I'll set off some time to do this tomorrow. |
|
@bsipocz - something is obviously wrong in the mock test I added but I can't figure out exactly what. Any hints? The monkey patching stuff is a bit confusing to me. |
bsipocz
left a comment
There was a problem hiding this comment.
There is a super nice 92% coverage, with and another nice 83% remote only coverage, so I'm fairly certain we got the majority of use cases under control :)
…bject_name. Fix doctest issues by adding +IGNORE OUTPUT. Fix remote test of query_aliases().
|
Thank you @rickynilsson! |
Fix query_aliases(). Now using
aliaslookupservice instead of deprecatedaliastable.