Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctest error in expect.py on Cygwin and OS X #9163

Closed
williamstein opened this issue Jun 7, 2010 · 12 comments
Closed

Doctest error in expect.py on Cygwin and OS X #9163

williamstein opened this issue Jun 7, 2010 · 12 comments

Comments

@williamstein
Copy link
Contributor

On Cygwin and on OS X 10.6, the doctest sage/interfaces/expect.py fails:

sage -t  "devel/sage/sage/interfaces/expect.py"             
**********************************************************************
File "/home/wstein/sage-4.4.3/devel/sage/sage/interfaces/expect.py", line 808:
    sage: print sage0.eval("alarm(1); singular._expect_expr('1')")
Expected:
    Control-C pressed.  Interrupting Singular. Please wait a few seconds...
    ...
    KeyboardInterrupt: computation timed out because alarm was set for 1 seconds
Got:
    ---------------------------------------------------------------------------
    KeyboardInterrupt                         Traceback (most recent call last)
    <BLANKLINE>
    /home/wstein/sage-4.4.3/data/extcode/sage/<ipython console> in <module>()
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in _expect_expr(self, expr, timeout)
        815             expr = self._prompt_wait
        816         if self._expect is None:
    --> 817             self._start()
        818         try:
        819             if timeout:
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/sage/interfaces/singular.pyc in _start(self, alt_message)
        373         """
        374         self.__libs = []
    --> 375         Expect._start(self, alt_message)
        376         # Load some standard libraries.
        377         self.lib('general')   # assumed loaded by misc/constants.py
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in _start(self, alt_message, block_during_init)
        447                 c = 'sage-native-execute  ssh %s "nohup sage -cleaner"  &'%self._server
        448                 os.system(c)
    --> 449             self._expect = pexpect.spawn(cmd, logfile=self.__logfile)
        450             if self._do_cleaner():
        451                 cleaner.cleaner(self._expect.pid, cmd)
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/pexpect.pyc in __init__(self, command, args, timeout, maxread, searchwindowsize, logfile)
        331 
        332         self.name = '<' + ' '.join (self.args) + '>'
    --> 333         self.__spawn()
        334 
        335     def __del__(self):
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/pexpect.pyc in __spawn(self)
        399 
        400         try:
    --> 401             self.pid, self.child_fd = pty.fork()
        402         except OSError, e:
        403             raise ExceptionPexpect('Pexpect: pty.fork() failed: ' + str(e))
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python/pty.pyc in fork()
         93 
         94     try:
    ---> 95         pid, fd = os.forkpty()
         96     except (AttributeError, OSError):
         97         pass
    <BLANKLINE>
    /home/wstein/sage-4.4.3/local/lib/python2.6/site-packages/sage/misc/misc.pyc in __mysig(a, b)
       1690 __alarm_time=0
       1691 def __mysig(a,b):
    -> 1692     raise KeyboardInterrupt, "computation timed out because alarm was set for %s seconds"%__alarm_time
       1693 
       1694 def alarm(seconds):
    <BLANKLINE>
    KeyboardInterrupt: computation timed out because alarm was set for 1 seconds
**********************************************************************
1 items had failures:
   1 of  10 in __main__.example_15
***Test Failed*** 1 failures.

CC: @simon-king-jena

Component: interfaces

Keywords: cygwin osx expect doctest

Author: Jeroen Demeyer

Reviewer: Volker Braun

Merged: sage-4.6.1.rc0

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

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

Changed keywords from none to cygwin osx expect doctest

@jdemeyer jdemeyer changed the title cygwin: output of a subtle test in expect.py differs slightly on cygwin Doctest error in expect.py on Cygwin and OS X Nov 13, 2010
@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 24, 2010

comment:3

Does this happen because the interface might be slow to start up?

Should we move the lines

        if self._expect is None:
            self._start()

in sage.interfaces.expect.Expect._expect_expr to inside its outermost try block?

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 24, 2010

comment:4

Or remove "Control-C pressed. Interrupting Singular. Please wait a few seconds..." from the expected output?

@jdemeyer
Copy link

comment:5

The problem is with the Singular interface, see #10476.

@jdemeyer jdemeyer assigned jdemeyer and unassigned williamstein Dec 14, 2010
@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer
Copy link

comment:7

Apart from this, expect.py is a huge mess...

@jdemeyer
Copy link

comment:9

Attachment: 9163_expect_expr.patch.gz

@mwhansen
Copy link
Contributor

comment:10

I cannot test this on Cygwin since I don't have a build right now. I do have one close to completion, but it fails due to #10247.

@jdemeyer
Copy link

Merged: sage-4.6.1.rc0

@vbraun
Copy link
Member

vbraun commented Jan 3, 2011

comment:12

I agree that Singular isn't a good test for the expect interfaces since it is quite finicky with being interrupted/restarting. Improving the Singular interface will be pursued in #10247. In the meantime, positive review for this ticket.

@jdemeyer
Copy link

jdemeyer commented Jan 7, 2011

Reviewer: Volker Braun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants