Opened 3 months ago

Closed 3 months ago

#27904 closed enhancement (fixed)

py3: fix last doctest in interfaces

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.8
Component: python3 Keywords:
Cc: tscrim, jhpalmieri, fbissey Merged in:
Authors: Frédéric Chapoton Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: 08a54c2 (Commits) Commit: 08a54c28a9e3971cde5f494b8f1058f547aa4883
Dependencies: Stopgaps:

Description


Change History (8)

comment:1 Changed 3 months ago by chapoton

  • Branch set to u/chapoton/27904
  • Commit set to 9ff58e06e4b4cdd4f970fcf8d43a25334934d05f
  • Status changed from new to needs_review

New commits:

9ff58e0py3: fix one doctest in interfaces

comment:2 Changed 3 months ago by chapoton

  • Cc tscrim jhpalmieri fbissey added

green bot, please review this simple change

comment:3 Changed 3 months ago by jhpalmieri

This fixes one doctest in interfaces, but not the last one, at least not for me. I still see

sage -t src/sage/interfaces/expect.py
**********************************************************************
File "src/sage/interfaces/expect.py", line 769, in sage.interfaces.expect.Expect._eval_line_using_file
Failed example:
    singular._eval_line_using_file('def a=3;', restart_if_needed=False)
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Singular terminated unexpectedly while reading in a large line...
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 921, in _eval_line
        E.sendline(line)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 577, in sendline
        return self.send(s + self.linesep)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 568, in send
        return os.write(self.child_fd, b)
    OSError: [Errno 5] Input/output error
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 791, in _eval_line_using_file
        s = self._eval_line(self._read_in_file_command(tmp_to_use), allow_use_file=False, restart_if_needed=False)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 945, in _eval_line
        raise_(RuntimeError, RuntimeError("%s\nError evaluating %s in %s" % (msg, line, self)), sys.exc_info()[2])
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/six.py", line 692, in reraise
        raise value.with_traceback(tb)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 921, in _eval_line
        E.sendline(line)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 577, in sendline
        return self.send(s + self.linesep)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 568, in send
        return os.write(self.child_fd, b)
    RuntimeError: [Errno 5] Input/output error
    Error evaluating < "/Users/jpalmier/.sage/temp/D-172-25-224-210.dhcp4.washington.edu/50145/interface/tmp50259"; in Singular
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.expect.Expect._eval_line_using_file[6]>", line 1, in <module>
        singular._eval_line_using_file('def a=3;', restart_if_needed=False)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 818, in _eval_line_using_file
        if "Input/output error" in msg[0]:  # This occurs on non-linux machines
    TypeError: 'RuntimeError' object is not subscriptable
**********************************************************************
File "src/sage/interfaces/expect.py", line 899, in sage.interfaces.expect.Expect._eval_line
Failed example:
    singular._eval_line_using_file('def a=3;', restart_if_needed=False)
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Singular terminated unexpectedly while reading in a large line...
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 921, in _eval_line
        E.sendline(line)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 577, in sendline
        return self.send(s + self.linesep)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 568, in send
        return os.write(self.child_fd, b)
    OSError: [Errno 5] Input/output error
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 791, in _eval_line_using_file
        s = self._eval_line(self._read_in_file_command(tmp_to_use), allow_use_file=False, restart_if_needed=False)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 945, in _eval_line
        raise_(RuntimeError, RuntimeError("%s\nError evaluating %s in %s" % (msg, line, self)), sys.exc_info()[2])
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/six.py", line 692, in reraise
        raise value.with_traceback(tb)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 921, in _eval_line
        E.sendline(line)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 577, in sendline
        return self.send(s + self.linesep)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 568, in send
        return os.write(self.child_fd, b)
    RuntimeError: [Errno 5] Input/output error
    Error evaluating < "/Users/jpalmier/.sage/temp/D-172-25-224-210.dhcp4.washington.edu/50145/interface/tmp50265"; in Singular
    <BLANKLINE>
    During handling of the above exception, another exception occurred:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.expect.Expect._eval_line[13]>", line 1, in <module>
        singular._eval_line_using_file('def a=3;', restart_if_needed=False)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.8.beta7/local/lib/python3.7/site-packages/sage/interfaces/expect.py", line 818, in _eval_line_using_file
        if "Input/output error" in msg[0]:  # This occurs on non-linux machines
    TypeError: 'RuntimeError' object is not subscriptable
**********************************************************************
2 items had failures:
   1 of  16 in sage.interfaces.expect.Expect._eval_line
   1 of   9 in sage.interfaces.expect.Expect._eval_line_using_file
    [101 tests, 2 failures, 3.35 s]
----------------------------------------------------------------------
sage -t src/sage/interfaces/expect.py  # 2 doctests failed

comment:4 Changed 3 months ago by chapoton

One needs to replace msg[0] by msg.args[0]. Let me do that.

comment:5 Changed 3 months ago by git

  • Commit changed from 9ff58e06e4b4cdd4f970fcf8d43a25334934d05f to 08a54c28a9e3971cde5f494b8f1058f547aa4883

Branch pushed to git repo; I updated commit sha1. New commits:

08a54c2trac 27904 fix msg handling in expect

comment:6 Changed 3 months ago by chapoton

works for me. Please check if it works for you.

comment:7 Changed 3 months ago by jhpalmieri

  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

Thank you, works with Python 2 and 3.

comment:8 Changed 3 months ago by vbraun

  • Branch changed from u/chapoton/27904 to 08a54c28a9e3971cde5f494b8f1058f547aa4883
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.