sagemath/sage

Make "sage -t -all" more robust, in particular when SAGE_SRC is SAGE_LIB

mkoeppe opened this issue · 5 comments

Observed on conda:

$ sage -t --all
too many failed tests, not using stored timings
Running doctests with ID 2021-02-06-16-05-28-bc4dacc2.
Using --optional=dochtml,pip,sage
Doctesting entire Sage library.
Traceback (most recent call last):
  File "/Users/mkoeppe/miniconda3/envs/sage/bin/sage-runtests", line 182, in <module>
    err = DC.run()
  File "/Users/mkoeppe/miniconda3/envs/sage/lib/python3.9/site-packages/sage/doctest/control.py", line 1234, in run
    self.expand_files_into_sources()
  File "/Users/mkoeppe/miniconda3/envs/sage/lib/python3.9/site-packages/sage/doctest/control.py", line 817, in expand_files_into_sources
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/Users/mkoeppe/miniconda3/envs/sage/lib/python3.9/site-packages/sage/doctest/control.py", line 817, in <listcomp>
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/Users/mkoeppe/miniconda3/envs/sage/lib/python3.9/site-packages/sage/doctest/sources.py", line 528, in __init__
    raise ValueError("unknown file extension %r"%ext)
ValueError: unknown file extension ''

Instead of showing an error, it should just warn about files that it cannot handle (and show their filenames so that it becomes clear what the problem is)

Depends on #32813

CC: @isuruf @jhpalmieri @fchapoton @seblabbe

Component: doctest framework

Issue created by migration from https://trac.sagemath.org/ticket/31352

Description changed:

--- 
+++ 
@@ -20,4 +20,4 @@
 ValueError: unknown file extension ''
 ```
 
-
+Instead of showing an error, it should just warn about files that it cannot handle (and show their filenames so that it becomes clear what the problem is)
comment:2

I think the relevant line is https://github.com/sagemath/sagetrac-mirror/blob/develop/src/sage/doctest/sources.py?h=9.3.beta7#n527. Changing this to a print statement might be good enough, and this worked in a simple test, but I'm not sure. I would feel more comfortable if, when an invalid file extension pops up, we explicitly tell the doctester to not test it, but maybe the other parts of the __init__ method take care of that somehow.

comment:5

Related: #32813

comment:6

I did one more commit in #32813 to also show the filename in the error message and not only the wrong extension. So it should cover the goal of this ticket too.

Dependencies: #32813