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
Corrected a spurious warning about the "value" attribute of VOTable <option>. #9470
Conversation
…option>. The table_test.py tests on gemini.xml exposed this bug but the "correct" return value from several tests was incorrectly set to accept the spurious warnings as acceptable. There are still 23 warnings on the existing test file; at some point it may be reasonable to look at the file by hand and determine whether it can be made more conformant, and then carry out the tests in future both on the conformant XML and the existing version, so as to have one test that expects no warnings, and another that tests that warnings are properly issued for bad XML.
The io/votable/tests/vo_test.py test also had been set up to accept the erroneous warnings produced by the bug fixed in this PR.
Hi. Can you please elaborate on this bug that you found? What did you see vs what you expected to see? Can you also add a regression test for this particular bug so it does not get re-introduced? p.s. Don't worry about the change log for now, as we're in the middle of feature freeze. |
Sorry, too late for the change log. The error was a one-word mistake in tree.py that had "data" and "name" as the acceptable attributes of the VOTable element; this is incorrect and the acceptable attributes are "value" and "name". Two existing tests in io/votable/tests produced this spurious message, but unfortunately the test assertions were written to consider it acceptable. For vo_test.py the spurious error, W48: Unknown attribute 'value' on OPTION <OPTION name="bogus" value="whatever"/> was included in the associated There is no need to add additional tests, I think, because this code path is already being tests and my corrections to the test cases would catch a future regression. |
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 won't have time to dig at the VO standards to confirm this before 4.0 feature freeze, so I tentatively milestoned it for 4.0.1, unless @tomdonaldson has time... 😬
CHANGES.rst
Outdated
@@ -72,6 +72,10 @@ astropy.io.registry | |||
astropy.io.votable | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
- Corrected a spurious warning issued for the ``value`` attribute of the | |||
``<OPTION>`` element in VOTable, as well as a test that erroneously | |||
treated the warning as acceptable. [#9470] |
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 needs to go in the "bug fix" sub-section. But please hold off on moving it until we can be sure of the milestone. Thanks!
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.
No problem. Thanks for being patient.
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.
@pllim I don't know whether @tomdonaldson will have time, but I posted some pre-digested snippets from the VOTable standard in a comment last night to make that review easier.
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.
Thank you, that'll certainly help!
As I suggested in one of the commit messages, it would be a further improvement to the test suite if someone - I could perhaps do this on another occasion - hand-cleaned the |
Here are the references that are relevant: VOTable 1.3, section 4.7, narrative text in paragraph beginning "All three MIN, MAX and OPTION sub-elements" confirms that <OPTION> has "value" and "name" attributes. VOTable 1.3, section 7.2, Attribute Summary Table, confirms this schema: XSD for <OPTION>, from VOTable 1.3, Appendix B:
The same references in VOTable 1.4: In addition, I think examining the source code directly will confirm that the erroneous presence of the string "data" was a very plausible cut/paste error or "think-o" arising from the frequent use of "data" as a variable name in that paragraph of code. |
Restores one line of lost test coverage by inserting a bad <OPTION> attribute into the gemini.xml test. Previously none of the tests actually had this particular XML fault, but the code bug fixed in io/votable/tree.py on the present PR was erroneously calling the error handler for it; now we have a test that really earned it.
I noticed that one of the automated tests showed a loss of test coverage from this PR. This is because it turns out that no legitimate instance of the "W48 Unknown attribute" error had been included in the test files. Thus, after the bug fix, the message was no longer emitted and the code path to emit it was not tested. Solution: add an actual instance of this fault to the |
I see the "continuous-integration/travis-ci/pr — The Travis CI build failed" and I have looked at the log file for the failing step at https://travis-ci.org/astropy/astropy/jobs/602689700?utm_medium=notification&utm_source=github_status I don't see anything actionable for me in that log - there are no signs of failure that I've been able to discern up through the moment that the post-build test fails with
Please let me know if there's anything I can do. |
@gpdf - That is unrelated, we did some refactoring for the pytest plugins we use. I'm not exactly certain how that ended up in that travis job, restarted it now, it should pass now. (but if it still has issues, we'll deal with that separately). |
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 agree with the assessment of this problem. The spec calls for the OPTION element to allow 'value' and 'name' elements, and the code does the same thing except in this one case where it's checking whether to issue the warning. This PR corrects that warning check, and I like that the gemini.xml test case was modified to exercise the warning code.
Given the approval above, I've moved the changelog to the bugfix section, and merging this now. Thank you @gpdf! |
The table_test.py tests on gemini.xml exposed this bug but the "correct"
return value from several tests was incorrectly set to accept the spurious
warnings as acceptable.
There are still 23 warnings on the existing test file; at some point it
may be reasonable to look at the file by hand and determine whether it
can be made more conformant, and then carry out the tests in future
both on the conformant XML and the existing version, so as to have one
test that expects no warnings, and another that tests that warnings are
properly issued for bad XML.