Opened 10 years ago

Closed 10 years ago

#12991 closed enhancement (fixed)

Don't doctest autogenerated rst files

Reported by: jhpalmieri Owned by: mvngu
Priority: minor Milestone: sage-5.1
Component: doctest coverage Keywords:
Cc: Merged in: sage-5.1.beta2
Authors: John Palmieri Reviewers: Keshav Kini
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by kini)

When we build the Sage documentation, we create lots of files which look like the following (SAGE_ROOT/devel/sage/doc/en/reference/sage/algebras/free_algebra_quotient_element.rst):

.. _sage.algebras.free_algebra_quotient_element:

Free algebra quotient elements

.. This file has been autogenerated.

.. automodule:: sage.algebras.free_algebra_quotient_element

When we run make ptestlong, these files get doctested. I don't think there is a good reason for this: we should skip these files when doctesting. There are two ways of doing this: patch the doctesting scripts to skip files containing \n.. This file has been autogenerated.\n, or write .. nodoctest as the first line of each of these files. The attached patch does the second of these (a patch to do the first is given in a comment below).

Attachments (1)

trac_12991-doctest.patch (794 bytes) - added by jhpalmieri 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by jhpalmieri

comment:1 Changed 10 years ago by kini

  • Description modified (diff)

comment:2 Changed 10 years ago by jhpalmieri

  • Status changed from new to needs_review

For the first approach, apply a patch like this to SAGE_ROOT/local/bin:

  • sage-ptest

    diff --git a/sage-ptest b/sage-ptest
    a b def skip(F): 
    133133        sys.stdout.flush()
    134134        printmutex.release()
    135135        return True
     136    TEXT = open(G).read()
    136137    filenm = os.path.split(F)[1]
    137138    if (filenm[0] == '.' or (os.path.sep + '.' in G.lstrip(os.path.sep + '.'))
    138         or 'nodoctest' in open(G).read()[:50]):
     139        or 'nodoctest' in TEXT[:50]
     140        or '\n.. This file has been autogenerated.\n' in TEXT):
    139141        return True
    140142    if G.find(os.path.join('doc', 'output')) != -1:
    141143        return True

comment:3 Changed 10 years ago by kini

  • Authors set to John Palmieri
  • Reviewers set to Keshav Kini
  • Status changed from needs_review to positive_review

The approach of your patch (rather than your comment) seems to me to be the correct one. It also passes tests on 5.0.beta1, and the code looks reasonable, so positive review from me.

comment:4 Changed 10 years ago by jdemeyer

  • Merged in set to sage-5.1.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.