Opened 11 years ago

Closed 11 years ago

#2934 closed defect (fixed)

[with patch; positive review] doctesting files outside of sage repo is completely broken!!

Reported by: was Owned by: failure
Priority: blocker Milestone: sage-3.0
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by was)


On Tue, Apr 15, 2008 at 9:11 AM, Jason Bandlow <> wrote:
> 
>  Hello all,
>  
>  Regarding doctesting, I'd like to work with the following setup:
>  1. Create a file work.sage (or work.py) somewhere in my home directory.
>  2. Start a notebook session, and attach work.sage.
>  3. Use the notebook for generating and staring at data, while using a
>  text editor to modify my code.
>  4. Periodically run: $ sage -t work.sage      to make sure that I
>  haven't completely fouled things up.
>  
>  Step 4 seems not to work (on Sage 2.11 on Ubuntu).  For example,
>  I created the following file, foo.py, in my ~/.sage directory:
>  
>  def foo(x):
>     r"""
>     Shows how doctests don't work.
>  
>     EXAMPLES:
>         sage: 2+2
>         5
>         sage: foo(3)
>         4
>     """
>     print(x)
>  
>  And then
>  $ sage -t --verbose ~/.sage/foo.py
>  
>  ----------------------------------------------------------------------
>  All tests passed!
>  Total time for all tests: 0.0 seconds
>  
>  $ sage -coverage ~/.sage/foo.py
>  ----------------------------------------------------------------------
>  foo.py
>  SCORE foo.py: 100% (1 of 1)
>  ----------------------------------------------------------------------
>  
>  
>  Can someone explain to me what's going on here?

Somebody (I don't want to name names; maybe it is me?) has completely
broken doctesting of user files, evidently.   There has
been a lot of changes made to the doctesting system
recently, and I don't know which thing caused the
above very serious problems.    Even doctesting a pure
.py file is broken!

teragon:.sage was$ more foo.py 
def foo(x):
   r"""
   Shows how doctests don't work.

   EXAMPLES:
       sage: 2+2
       5
       sage: foo(3)
       4
   """
   print(x)

teragon:.sage was$ sage -t foo.py
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 0.0 seconds


 -- William

Attachments (1)

scripts-2934.patch (1.6 KB) - added by was 11 years ago.
apply this to the hg_scripts repo.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 11 years ago by was

  • Description modified (diff)

comment:2 Changed 11 years ago by mhansen

I can only reproduce this when the .py file is in a directory starting with a "."

comment:3 Changed 11 years ago by was

mhansen -- you're right, this problem only occurs when the filename is in a directory starting with a .dot. E.g., in my test above I was in $HOME/.sage.

comment:4 Changed 11 years ago by mabshoff

  • Milestone changed from sage-3.0.1 to sage-3.0

Changed 11 years ago by was

apply this to the hg_scripts repo.

comment:5 Changed 11 years ago by was

  • Summary changed from doctesting files outside of sage repo is completely broken!! to [with patch; needs review] doctesting files outside of sage repo is completely broken!!

The attached patch scripts-2934.patch enables doctesting in hidden directories. This used to be disabled since we kept lots of temp data in ./doctest -- but now we don't do to some nice changes made by Timothy Abbot.

comment:6 Changed 11 years ago by mhansen

  • Summary changed from [with patch; needs review] doctesting files outside of sage repo is completely broken!! to [with patch; positive review] doctesting files outside of sage repo is completely broken!!

Looks good to me and fixes the problem.

comment:7 Changed 11 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged in Sage 3.0.rc1

Note: See TracTickets for help on using tickets.