Opened 18 months ago
Closed 11 months ago
#19271 closed defect (fixed)
Fix logging in doctester
Reported by:  SimonKing  Owned by:  

Priority:  critical  Milestone:  sage7.2 
Component:  doctest framework  Keywords:  
Cc:  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  Frédéric Chapoton 
Report Upstream:  N/A  Work issues:  
Branch:  fd4148a (Commits)  Commit:  fd4148a47f3161c9f4c776011886e005ad60b3f8 
Dependencies:  Stopgaps: 
Description
When doing "make test" and getting errors, it is visible in the terminal which test failed, what output was expected and what output was received. For example:
File "src/sage/matrix/matrix2.pyx", line 3804, in sage.matrix.matrix2.Matrix.diagonal.right_kernel Failed example: P = B.right_kernel(basis = 'pivot'); P Expected: Vector space of degree 4 and dimension 2 over Finite Field in a of size 5^2 User basis matrix: [ 4 4 1 0] [ a + 2 3*a + 3 0 1] Got: Vector space of degree 4 and dimension 2 over Finite Field in a of size 5^2 Basis matrix: [ 4 4 1 0] [ 0 2*a + 1 a + 2 1]
However, SAGE_ROOT/logs/test.log only says:
sage t src/sage/matrix/strassen.pyx [69 tests, 1.60 s] sage t src/sage/matrix/matrix2.pyx [2191 tests, 5 failures, 18.24 s] sage t src/sage/modules/vector_complex_double_dense.pxd [0 tests, 0.00 s] ... sage t src/sage/matrix/matrix2.pyx # 5 doctests failed
In other words, test.log does in fact *not* log test.
Change History (20)
comment:1 Changed 18 months ago by
comment:2 Changed 18 months ago by
 Summary changed from logs/test.log should log the tests to Fix logging in doctester
comment:3 Changed 18 months ago by
 Branch set to u/jdemeyer/logs_test_log_should_log_the_tests
comment:4 Changed 18 months ago by
 Commit set to f77a84df397bb3bf9964b13e2ed006f3a4f01ef4
 Status changed from new to needs_review
New commits:
f77a84d  Improve doctest logging

comment:5 Changed 18 months ago by
doc does not build
comment:6 Changed 18 months ago by
 Commit changed from f77a84df397bb3bf9964b13e2ed006f3a4f01ef4 to 43d33d4b8abd0ad8ffa193fb900d4036f5c6122a
Branch pushed to git repo; I updated commit sha1. New commits:
43d33d4  Fix documentation

comment:7 Changed 18 months ago by
doc still does not build
comment:8 Changed 18 months ago by
I think you also need this change:

src/sage/doctest/control.py
diff git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index ac7fec0..6bff5c7 100644
a b class Logger(object): 210 210 self.files = list(files) 211 211 212 212 def write(self, x): 213 """213 r""" 214 214 Write ``x`` to all files. 215 215 216 216 TESTS::
comment:9 Changed 18 months ago by
 Commit changed from 43d33d4b8abd0ad8ffa193fb900d4036f5c6122a to 4999fa2980b2a5e3105459caf9f7a49d900f1c3e
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
4999fa2  Fix documentation

comment:10 Changed 18 months ago by
one failing doctest
comment:11 Changed 18 months ago by
 Commit changed from 4999fa2980b2a5e3105459caf9f7a49d900f1c3e to 58288915926164d4f120425e929cecb5706c1e48
Branch pushed to git repo; I updated commit sha1. New commits:
5828891  Flush diagnostic messages

comment:12 Changed 18 months ago by
Sorry for the mess. It should be fixed now.
comment:13 Changed 11 months ago by
 Milestone changed from sage6.9 to sage7.2
I have failing doctests with the branch here.
File "src/sage/doctest/test.py", line 299, in sage.doctest.test Failed example: print(open(t).read()) Expected: Running doctests... Doctesting 1 file. sage t warnlong 0.0 simple_failure.rst ********************************************************************** File "simple_failure.rst", line 7, in sage.doctest.tests.simple_failure Failed example: a * b Expected: 20 Got: 15 ********************************************************************** 1 item had failures: 1 of 5 in sage.doctest.tests.simple_failure [4 tests, 1 failure, ...]  sage t warnlong 0.0 simple_failure.rst # 1 doctest failed  ... Got: <BLANKLINE>
and another one in the same file.
comment:14 Changed 11 months ago by
I haven't tested it in a while. I will have a look later.
comment:15 Changed 11 months ago by
@chapoton: I don't get those failures and neither does the patchbot...
I fixed one failure with the gdb
package.
comment:16 Changed 11 months ago by
 Commit changed from 58288915926164d4f120425e929cecb5706c1e48 to 50c6c5a101e5219008527cfe8ac5911c5d09605e
comment:17 Changed 11 months ago by
Got it, the problems appears only when not using long
.
comment:18 Changed 11 months ago by
 Commit changed from 50c6c5a101e5219008527cfe8ac5911c5d09605e to fd4148a47f3161c9f4c776011886e005ad60b3f8
comment:19 Changed 11 months ago by
 Reviewers set to Frédéric Chapoton
 Status changed from needs_review to positive_review
ok, looks good to me
comment:20 Changed 11 months ago by
 Branch changed from u/jdemeyer/logs_test_log_should_log_the_tests to fd4148a47f3161c9f4c776011886e005ad60b3f8
 Resolution set to fixed
 Status changed from positive_review to closed
I have seen this error reported before, but I never looked into it.