Subject: bug#68126: test failure in python-ipython 8.5.0 on powerpc64le (flaky?)

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 29 Dec 2023 21:08:42 -0500

Hi,

[email-masked] (Cuirass) writes:

> <p>The build <b>python-ipython.powerpc64le-linux</b> for specification <b>master</b> is
> broken. You can find the detailed information about this build <a
> href="https://ci.guix.gnu.org/build/3099199/details">here</a>.</p>
>
> https://ci.guix.gnu.org/build/3099199/details

--8<---------------cut here---------------start------------->8---
=================================== FAILURES ===================================
__________________ test_debug_magic_passes_through_generators __________________

    @contextmanager
    def _wrap_ptyprocess_err():
        """Turn ptyprocess errors into our own ExceptionPexpect errors"""
        try:
>           yield

/gnu/store/ygac2wk64z8bwz3i1v9qjghbqg8di2q7-python-pexpect-4.8.0/lib/python3.10/site-packages/pexpect/pty_spawn.py:23: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pexpect.pty_spawn.spawn object at 0x7fff55eaa080>, force = True

    def close(self, force=True):
        '''This closes the connection with the child application. Note that
        calling close() more than once is valid. This emulates standard Python
        behavior with files. Set force to True if you want to make sure that
        the child is terminated (SIGKILL is sent if the child ignores SIGHUP
        and SIGINT). '''
    
        self.flush()
        with _wrap_ptyprocess_err():
            # PtyProcessError may be raised if it is not possible to terminate
            # the child.
>           self.ptyproc.close(force=force)

/gnu/store/ygac2wk64z8bwz3i1v9qjghbqg8di2q7-python-pexpect-4.8.0/lib/python3.10/site-packages/pexpect/pty_spawn.py:328: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PtyProcess.spawn(['/gnu/store/slnz6nv5lmj38px3yy43g4b5lmfrj09v-python-wrapper-3.10.7/bin/python', '-m', 'IPython', '--...PYTEST_CURRENT_TEST': 'IPython/terminal/tests/test_debug_magic.py::test_debug_magic_passes_through_generators (call)'})
force = True

    def close(self, force=True):
        '''This closes the connection with the child application. Note that
        calling close() more than once is valid. This emulates standard Python
        behavior with files. Set force to True if you want to make sure that
        the child is terminated (SIGKILL is sent if the child ignores SIGHUP
        and SIGINT). '''
        if not self.closed:
            self.flush()
            self.fileobj.close() # Closes the file descriptor
            # Give kernel time to update process status.
            time.sleep(self.delayafterclose)
            if self.isalive():
                if not self.terminate(force):
>                   raise PtyProcessError('Could not terminate the child.')
E                   ptyprocess.ptyprocess.PtyProcessError: Could not terminate the child.

/gnu/store/hlmc99r0g2b5cy2j78366036sgjgm7cn-python-ptyprocess-0.5.2/lib/python3.10/site-packages/ptyprocess/ptyprocess.py:393: PtyProcessError

During handling of the above exception, another exception occurred:

    @skip_win32
    def test_debug_magic_passes_through_generators():
        """
        This test that we can correctly pass through frames of a generator post-mortem.
        """
        import pexpect
        import re
        in_prompt = re.compile(br'In ?\[\d+\]:')
        ipdb_prompt = 'ipdb>'
        env = os.environ.copy()
        child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor', '--simple-prompt'],
                              env=env)
        child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
    
        child.expect(in_prompt)
    
        child.timeout = 2 * IPYTHON_TESTING_TIMEOUT_SCALE
    
        child.sendline("def f(x):")
        child.sendline("    raise Exception")
        child.sendline("")
    
        child.expect(in_prompt)
        child.sendline("gen = (f(x) for x in [0])")
        child.sendline("")
    
        child.expect(in_prompt)
        child.sendline("for x in gen:")
        child.sendline("    pass")
        child.sendline("")
    
        child.timeout = 10 * IPYTHON_TESTING_TIMEOUT_SCALE
    
        child.expect('Exception:')
    
        child.expect(in_prompt)
        child.sendline(r'%debug')
        child.expect('----> 2     raise Exception')
    
        child.expect(ipdb_prompt)
        child.sendline('u')
        child.expect_exact(r'----> 1 gen = (f(x) for x in [0])')
    
        child.expect(ipdb_prompt)
        child.sendline('u')
        child.expect_exact('----> 1 for x in gen:')
    
        child.expect(ipdb_prompt)
        child.sendline('u')
        child.expect_exact('*** Oldest frame')
    
        child.expect(ipdb_prompt)
        child.sendline('exit')
    
        child.expect(in_prompt)
        child.sendline('exit')
    
>       child.close()

IPython/terminal/tests/test_debug_magic.py:80: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/gnu/store/ygac2wk64z8bwz3i1v9qjghbqg8di2q7-python-pexpect-4.8.0/lib/python3.10/site-packages/pexpect/pty_spawn.py:325: in close
    with _wrap_ptyprocess_err():
/gnu/store/6mwp6qhfds9pp7xmj93gs9hvdys9yphj-python-3.10.7/lib/python3.10/contextlib.py:153: in __exit__
    self.gen.throw(typ, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @contextmanager
    def _wrap_ptyprocess_err():
        """Turn ptyprocess errors into our own ExceptionPexpect errors"""
        try:
            yield
        except ptyprocess.PtyProcessError as e:
>           raise ExceptionPexpect(*e.args)
E           pexpect.exceptions.ExceptionPexpect: Could not terminate the child.

/gnu/store/ygac2wk64z8bwz3i1v9qjghbqg8di2q7-python-pexpect-4.8.0/lib/python3.10/site-packages/pexpect/pty_spawn.py:25: ExceptionPexpect

[...]

FAILED IPython/terminal/tests/test_debug_magic.py::test_debug_magic_passes_through_generators
= 1 failed, 1002 passed, 67 skipped, 1 xpassed, 130 warnings in 305.79s (0:05:05) =
error: in phase 'check': uncaught exception:
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim