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
tol and optional in doctests don't play well together #12493
Comments
comment:1
If we add print statement
we get the very interesting
|
comment:2
Removing the final empty line changes things, though it doesn't help.
I can confirm that manually getting rid of this causes the tests to pass. A lot of trial and error as to which lines cause the problem has had no luck so far... |
comment:3
Okay, it's these lines.
Somehow we must be using this abs tol thing incorrectly. |
This comment has been minimized.
This comment has been minimized.
comment:5
In case I can't track this down and someone from #10952 can help, here is the end of the comment modifiers.
|
comment:6
I think it's something else in |
comment:7
Replacing this comment with Apparently the doctest framework has trouble with |
comment:8
Yup. Not guilty! Here's a minimal failing test case:
|
comment:9
LOL on the base 5 optional test! Though I wouldn't say it's minimal, strictly speaking - you actually explained yourself. Hopefully someone at #10952 will fix this; I'm not interested in breaking the doctest script by fixing this in some stupid fashion. |
This comment has been minimized.
This comment has been minimized.
comment:11
I think I've found the problem and fixed it, but please test it: try it on the Sage library, try it on files with doctests which are intentionally supposed to fail (modify |
Author: John Palmieri |
Reviewer: Marco Streng |
comment:12
I think the count is still wrong. I added a print statement to sage-doctest that lists the lines and the corresponding modifiers:
Lines with tol give a mismatch, even with the patch. As a consequence, the following file passes all tests with
(13 lines, 15 modifiers, and the magma modifiers ended up on empty lines at the end, hence the pass with The file fails the test with |
comment:13
If you have a doctest marked "# optional - requires magma and is wrong", then it is supposed to only get tested if you run something like
Actually, there is a bug so it only gets tested if you run
In any case, it's not surprising that your file passed doctests: the optional doctest wasn't run, because you didn't give the right command-line flags. When I try your file with
I get a doctest failure. See #11615 for a fix to make |
comment:14
Thanks for explaining why this particular example was wrong. Could you explain what is wrong with the rest of my comment too? |
comment:15
It looks like you're right, the new comment was being added too many times. Here's a new patch; try this instead. |
scripts repo |
comment:16
Attachment: trac_12493.patch.gz All tests pass with the patch. But since this changes the doctesting framework, I needed to construct a doctest that is supposed to fail, and check whether it gives the correct failures. This made me stumble upon many problems with tol in doctesting. Take this example:
The output when doctesting is
So the out of tolerance is mentioned for the wrong test. And the error of the test "blah+blah" is not even listed. It gets worse if you remove the part that says
Then the python file produced for doctesting has a syntax error due to a blank line after the tolerance output.
Any test with tolerance followed by a blank line will produce a syntax error and end the doctesting of the whole file. I guess I will have to work harder to find a set of doctests that avoids these issues, but still adequately tests whether attachment: trac_12493.patch is a good idea. |
comment:17
Yikes! Thanks for working hard to get something that actually works for this. Or you can just fix the |
Merged: sage-5.0.beta14 |
See this sage-release thread and posts by Marco Streng. This bug is caused by #10923.
This is verified on several systems.
Apply attachment: trac_12493.patch to the scripts repo.
CC: @mstreng @sagetrac-tmonteil @orlitzky
Component: doctest coverage
Author: John Palmieri
Reviewer: Marco Streng
Merged: sage-5.0.beta14
Issue created by migration from https://trac.sagemath.org/ticket/12493
The text was updated successfully, but these errors were encountered: