Skip to content

test_decorator_skip_with_breakpoint failure on Python 3.13 #14458

@hroncok

Description

@hroncok

Hello, when we build ipython 8.25.0 in Fedora with Python 3.13.0b2, we see this test failure:

_____________________ test_decorator_skip_with_breakpoint ______________________

    @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="issues on PyPy")
    @skip_win32
    def test_decorator_skip_with_breakpoint():
        """test that decorator frame skipping can be disabled"""
    
        import pexpect
    
        env = os.environ.copy()
        env["IPY_TEST_SIMPLE_PROMPT"] = "1"
        env["PROMPT_TOOLKIT_NO_CPR"] = "1"
    
        child = pexpect.spawn(
            sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
        )
        child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
        child.str_last_chars = 500
    
        child.expect("IPython")
        child.expect("\n")
    
        child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
    
        ### we need a filename, so we need to exec the full block with a filename
        with NamedTemporaryFile(suffix=".py", dir=".", delete=True) as tf:
            name = tf.name[:-3].split("/")[-1]
            tf.write("\n".join([dedent(x) for x in skip_decorators_blocks[:-1]]).encode())
            tf.flush()
            codeblock = f"from {name} import f"
    
            dedented_blocks = [
                codeblock,
                "f()",
            ]
    
            in_prompt_number = 1
            for cblock in dedented_blocks:
                child.expect_exact(f"In [{in_prompt_number}]:")
                in_prompt_number += 1
                for line in cblock.splitlines():
                    child.sendline(line)
                    child.expect_exact(line)
                child.sendline("")
    
            # as the filename does not exists, we'll rely on the filename prompt
            child.expect_exact("47     bar(3, 4)")
    
            for input_, expected in [
                (f"b {name}.py:3", ""),
                ("step", "1---> 3     pass # should not stop here except"),
                ("step", "---> 38 @pdb_skipped_decorator"),
                ("continue", ""),
            ]:
                child.expect("ipdb>")
                child.sendline(input_)
                child.expect_exact(input_)
>               child.expect_exact(expected)

core/tests/test_debugger.py:505: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.13/site-packages/pexpect/spawnbase.py:432: in expect_exact
    return exp.expect_loop(timeout)
/usr/lib/python3.13/site-packages/pexpect/expect.py:181: in expect_loop
    return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pexpect.expect.Expecter object at 0x7feb3f17f1c0>
err = TIMEOUT('Timeout exceeded.')

    def timeout(self, err=None):
        spawn = self.spawn
    
        spawn.before = spawn._before.getvalue()
        spawn.after = TIMEOUT
        index = self.searcher.timeout_index
        if index >= 0:
            spawn.match = TIMEOUT
            spawn.match_index = index
            return index
        else:
            spawn.match = None
            spawn.match_index = None
            msg = str(spawn)
            msg += '\nsearcher: %s' % self.searcher
            if err is not None:
                msg = str(err) + '\n' + msg
    
            exc = TIMEOUT(msg)
            exc.__cause__ = None    # in Python 3.x we can use "raise exc from None"
>           raise exc
E           pexpect.exceptions.TIMEOUT: Timeout exceeded.
E           <pexpect.pty_spawn.spawn object at 0x7feb3f491810>
E           command: /usr/bin/python3
E           args: ['/usr/bin/python3', '-m', 'IPython', '--colors=nocolor']
E           buffer (last 500 chars): b'b.set_trace()\r\n---> 47     bar(3, 4)\r\n\r\nipdb> '
E           before (last 500 chars): b'\r\n> /builddir/build/BUILD/ipython-8.25.0-build/BUILDROOT/usr/lib/python3.13/site-packages/IPython/tmpaoajv_2_.py(47)f()\r\n     43 import IPython.terminal.debugger as ipdb\r\n     44 \r\n     45 def f():\r\n     46     ipdb.set_trace()\r\n---> 47     bar(3, 4)\r\n\r\nipdb> '
E           after: <class 'pexpect.exceptions.TIMEOUT'>
E           match: None
E           match_index: None
E           exitstatus: None
E           flag_eof: False
E           pid: 4347
E           child_fd: 17
E           closed: False
E           timeout: 20.0
E           delimiter: <class 'pexpect.exceptions.EOF'>
E           logfile: None
E           logfile_read: None
E           logfile_send: None
E           maxread: 2000
E           ignorecase: False
E           searchwindowsize: None
E           delaybeforesend: 0.05
E           delayafterclose: 0.1
E           delayafterterminate: 0.1
E           searcher: searcher_string:
E               0: b'1---> 3     pass # should not stop here except'

/usr/lib/python3.13/site-packages/pexpect/expect.py:144: TIMEOUT

Setting a higher IPYTHON_TESTING_TIMEOUT_SCALE does not seem to help. I don't know what changed in 3.13 that might be related to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions