Opened 11 years ago

Last modified 8 years ago

#12061 needs_work enhancement

Doctest interfaces/psage.py

Reported by: Punarbasu Purkayastha Owned by: William Stein
Priority: minor Milestone: sage-6.4
Component: interfaces Keywords: doctest
Cc: Merged in:
Authors: Punarbasu Purkayastha Reviewers:
Report Upstream: N/A Work issues: find out why doctests change every sage version
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Punarbasu Purkayastha)

Towards completing #12024.


Apply only trac_12061.txt to devel/sage.

Attachments (4)

trac_12061-doctest_interfaces_psage.patch (3.9 KB) - added by Punarbasu Purkayastha 11 years ago.
Apply to devel/sage
trac_12061-doctest_interfaces_psage.2.patch (7.7 KB) - added by Punarbasu Purkayastha 11 years ago.
Apply to devel/sage
trac_12061.txt (10.6 KB) - added by Punarbasu Purkayastha 11 years ago.
Apply only this patch to devel/sage
test.patch (870 bytes) - added by Punarbasu Purkayastha 11 years ago.

Download all attachments as: .zip

Change History (21)

Changed 11 years ago by Punarbasu Purkayastha

Apply to devel/sage

comment:1 Changed 11 years ago by Punarbasu Purkayastha

Form some reason doctesting this file goes into an infinite recursion with twisted, but all the commands work on the Sage command line. I had to run it like this to see the output .sage/tmp/psage_26566.py is the file Sage created while trying to doctest.

PYTHONVERBOSE=1 ~/Installations/sage-4.7.2/sage -python psage_26566.py 2>&1 | tee ~/test.out

And ~/test.out contains in particular this output just before the infinite recursion starts:

import sage.modules.vector_double_dense # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/modules/vector_double_dense.so
dlopen("/home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/modules/vector_real_double_dense.so", 2);
import sage.modules.vector_real_double_dense # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/modules/vector_real_double_dense.so
import sage.finance.time_series # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/finance/time_series.so
import sage.stats.intlist # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/stats/intlist.so
# /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/plot3d/implicit_plot3d.pyc matches /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/plot3d/implicit_plot3d.py
import sage.plot.plot3d.implicit_plot3d # precompiled from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/plot3d/implicit_plot3d.pyc
dlopen("/home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/plot3d/implicit_surface.so", 2);
import sage.plot.plot3d.implicit_surface # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/plot3d/implicit_surface.so
dlopen("/home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/complex_plot.so", 2);
import sage.plot.complex_plot # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/complex_plot.so
Exception IOError: IOError(2, 'No such file or directory') in <bound method SageElement.__del__ of <<currently executing code>>> ignored
dlopen("/home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/libs/flint/flint.so", 2);
import sage.libs.flint.flint # dynamically loaded from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/sage/libs/flint/flint.so
# /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/reactor.pyc matches /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/reactor.py
import twisted.internet.reactor # precompiled from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/reactor.pyc
# /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/selectreactor.pyc matches /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/selectreactor.py
import twisted.internet.selectreactor # precompiled from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/selectreactor.pyc
# /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/interfaces.pyc matches /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/interfaces.py
import twisted.internet.interfaces # precompiled from /home/punarbasu/Installations/sage-4.7.2/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-linux-x86_64.egg/twisted/internet/interfaces.pyc
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
 ignored

Changed 11 years ago by Punarbasu Purkayastha

Apply to devel/sage

comment:2 Changed 11 years ago by Punarbasu Purkayastha

Description: modified (diff)
Status: newneeds_review
Type: defectenhancement

Finally I have been able to figure out the cause of the infinite recursion. The fix is present in the patch.

comment:3 Changed 11 years ago by Punarbasu Purkayastha

Two functions are not directly or indirectly doctested: PSage._send_nowait() and PSageElement.is_locked(). Is the latter class even used??

comment:4 Changed 11 years ago by Jeroen Demeyer

Status: needs_reviewneeds_work

Why add time.sleep(10)?

If you do, you also need to add "# long time".

comment:5 in reply to:  4 Changed 11 years ago by Punarbasu Purkayastha

Replying to jdemeyer:

Why add time.sleep(10)?

If you do, you also need to add "# long time".

I did this after testing many different inputs and this was one input which doesn't take too long but which also doesn't give the result immediately. So, time.sleep(10) is there to wait until the computations are all over.

Is there a better way to test this? Otherwise, I will add # long time as you suggested.

comment:6 Changed 11 years ago by Punarbasu Purkayastha

Hmm.. I have a patch ready but I am unable to upload it. Something is wrong with trac. The upload page is simply stuck and never finishes the upload. I will just record the terminal output here and upload the patch some other day.

...2.experimental/devel/sage» ../../sage -t -long sage/interfaces/psage.py 
sage -t -long "devel/sage-main/sage/interfaces/psage.py"    
	 [24.8 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 24.8 seconds
...2.experimental/devel/sage» ../../sage -coverage sage/interfaces/psage.py 
----------------------------------------------------------------------
sage/interfaces/psage.py
ERROR: Please add a `TestSuite(s).run()` doctest.
SCORE sage/interfaces/psage.py: 71% (10 of 14)

Missing documentation:
	 * _start(self):
	 * _send_nowait(self, x):
	 * _object_class(self):
	 * is_locked(self):

----------------------------------------------------------------------

Changed 11 years ago by Punarbasu Purkayastha

Attachment: trac_12061.txt added

Apply only this patch to devel/sage

comment:7 Changed 11 years ago by Punarbasu Purkayastha

Description: modified (diff)
Status: needs_workneeds_review

There seems to be some weird problem with trac. I am unable to upload the original file since it contained

:trac:`1991`

instead of

:trac:`#1991`

Even after I did that change, I am unable to upload it as a .patch file. So I renamed the file and it works.

Changed 11 years ago by Punarbasu Purkayastha

Attachment: test.patch added

comment:8 Changed 11 years ago by Punarbasu Purkayastha

Keywords: sd40.5 added

comment:9 Changed 11 years ago by Punarbasu Purkayastha

patchbot: apply trac_12061.txt

comment:10 Changed 11 years ago by Punarbasu Purkayastha

Keywords: sd40.5 removed

removing sd40.5. This PSage has extremely weird behavior which changes between several different versions of Sage. The doctests used to all pass earlier and now they don't.

comment:11 Changed 10 years ago by Jeroen Demeyer

Please fill in your real name as Author.

comment:12 Changed 10 years ago by Punarbasu Purkayastha

Authors: Punarbasu Purkayastha

Sorry jdemeyer. It seems I tend to not fill up author fields. Will try to remember to do so from next time.

comment:13 Changed 10 years ago by Punarbasu Purkayastha

Status: needs_reviewneeds_work
Work issues: find out why doctests change every sage version

comment:14 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:15 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:16 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:17 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4
Note: See TracTickets for help on using tickets.