On Thursday, August 1, 2013 5:49:06 PM UTC-7, davidp wrote: > > I have a file called hyperplane_arrangement.py in my home directory, and > when I run > > sage -t hyperplane_arrangement.py > > from my home directory, all tests pass. The same file appears in the > directory SAGEHOME/devel/sage-test/sage/geometry. If I cd into that > directory and run sage -t hyperplane_arrangement.py, many tests don't pass. > (I diff-ed the files, and they are identical.) > > The problem seems to be that a certain helper class "AffineSubspace" in > hyperplane_arrangement.py is not being imported in the latter case. >
If a file is not in the Sage library, then when you doctest it, it gets loaded beforehand. If a file is in the Sage library (as it seems to think in the second case), then it does not get loaded beforehand. You need to import things explicitly when doctesting files in the Sage library. For example, from the file doctests/sources.py: def get_basename(path): """ This function returns the basename of the given path, e.g. sage.doctest.sources or doc.ru.tutorial.tour_advanced EXAMPLES:: sage: from sage.doctest.sources import get_basename ... The function is imported explicitly before it gets tested. -- John -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.