Ticket #12061 (needs_work enhancement)

Opened 18 months ago

Last modified 10 months ago

Doctest interfaces/psage.py

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

Description (last modified by ppurka) (diff)

Towards completing #12024.


Apply only trac_12061.txt Download to devel/sage.

Attachments

trac_12061-doctest_interfaces_psage.patch Download (3.9 KB) - added by ppurka 18 months ago.
Apply to devel/sage
trac_12061-doctest_interfaces_psage.2.patch Download (7.7 KB) - added by ppurka 15 months ago.
Apply to devel/sage
trac_12061.txt Download (10.6 KB) - added by ppurka 13 months ago.
Apply only this patch to devel/sage
test.patch Download (870 bytes) - added by ppurka 13 months ago.

Change History

Changed 18 months ago by ppurka

Apply to devel/sage

comment:1 Changed 18 months ago by ppurka

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 15 months ago by ppurka

Apply to devel/sage

comment:2 Changed 15 months ago by ppurka

  • Status changed from new to needs_review
  • Type changed from defect to enhancement
  • Description modified (diff)

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

comment:3 Changed 15 months ago by ppurka

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

comment:4 follow-up: ↓ 5 Changed 14 months ago by jdemeyer

  • Status changed from needs_review to needs_work

Why add time.sleep(10)?

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

comment:5 in reply to: ↑ 4 Changed 14 months ago by ppurka

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 13 months ago by ppurka

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 13 months ago by ppurka

Apply only this patch to devel/sage

comment:7 Changed 13 months ago by ppurka

  • Status changed from needs_work to needs_review
  • Description modified (diff)

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 13 months ago by ppurka

comment:8 Changed 12 months ago by ppurka

  • Keywords sd40.5 added

comment:9 Changed 12 months ago by ppurka

patchbot: apply trac_12061.txt

comment:10 Changed 12 months ago by ppurka

  • 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 months ago by jdemeyer

Please fill in your real name as Author.

comment:12 Changed 10 months ago by ppurka

  • Authors set to 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 months ago by ppurka

  • Status changed from needs_review to needs_work
  • Work issues set to find out why doctests change every sage version
Note: See TracTickets for help on using tickets.