-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
optional doctests: clean up and document "known bug", "optional: requires PKG" #11615
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
By the way, the patch to the scripts library also fixes a bug: if you have a doctest marked
and run Previously, you could use the undocumented
and it would work. With the patch, this no longer works unless there is white space between pkg1 and pkg2 (commas are still allowed). I couldn't find any instances of tags separated by commas but no spaces in the Sage library. The patch to the Sage library clarifies the documentation, saying that you need spaces between the package names. |
comment:3
This should perhaps be added to the meta-ticket #11337. |
comment:4
I like this, and it still applies! Here is something to ask. Could have two Adding doctest
to a file gives
and the same happens with Otherwise the patch seems fine, and doc looks good (naturally!). |
Reviewer: Karl-Dieter Crisman |
comment:5
Good point. I've changed the code. Now if I doctest this function: def testing():
"""
EXAMPLES::
sage: 2+2 # optional -- known bug
5
sage: 2+2 # known bug
6
sage: 2+2 # optional
7
"""
pass I get three failures with |
scripts repo |
comment:6
Attachment: trac_11615-scripts-repo.patch.gz Okay, so it looks like
Here is a very very corner case.
This only runs with What do you think about these two things? Maybe neither one is an issue. Otherwise I do think this is in pretty good shape. |
comment:7
Replying to @kcrisman:
I can do that.
This is the old behavior: marking a doctest |
comment:8
Ok, great. I hope I tested this enough. |
comment:9
Here is a new documentation patch, which just makes the following change: diff --git a/doc/en/developer/conventions.rst b/doc/en/developer/conventions.rst
--- a/doc/en/developer/conventions.rst
+++ b/doc/en/developer/conventions.rst
@@ -880,7 +880,7 @@ mind:
Then the doctest will be skipped by default, but could be revealed
by running ``sage -t --only-optional=bug ...``. (A doctest marked
as ``known bug`` gets automatically converted to ``optional bug``,
- so it is also detected by ``--only-optional=bug``.)
+ so it is also detected by ``--optional`` or ``--only-optional=bug``.)
- If the entire documentation string contains all three words
``optional``, ``package``, and ``installed``, then the entire |
Sage library |
comment:10
Attachment: trac_11615-document-known-bug.patch.gz Thanks, this should be a good addition. Hmm, Trac upgrade smells nice so far. And still seems left-aligned, nice. |
Merged: sage-5.0.beta10 |
Marking a doctest
# known bug
means that it is skipped unless the--optional
flag is passed tosage -t
. This needs to be documented.Also, many doctests in Sage are marked
# optional - requires PKG
, and this means thatsage -t -only-optional=PKG ...
does not run the test: the word "requires" is interpreted as a package name. This is not ideal.The attached patch to the scripts repo removes the word "requires" (and also "needs") automatically. It also allows a colon or comma instead of a hyphen, as in
# optional: requires PKG
. It also converts tests marked as "known bug" to tests marked as "optional bug", so they are run when you dosage -t -only-optional=bug ...
. The attached patch to the main Sage library documents all of this.Apply
CC: @nexttime
Component: doctest coverage
Author: John Palmieri
Reviewer: Karl-Dieter Crisman
Merged: sage-5.0.beta10
Issue created by migration from https://trac.sagemath.org/ticket/11615
The text was updated successfully, but these errors were encountered: