From d46b8832dabafb6eadf3f2f4d833527dccae6677 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 13 Oct 2024 18:00:55 +0200 Subject: [PATCH] Merge pull request #12885 from The-Compiler/pdb-py311 Fix pdb selftests on Python 3.13 (cherry picked from commit a4e40bcf77f29615a12a12758e5307d3f4ee0663) --- .github/workflows/test.yml | 2 +- changelog/12497.contrib.rst | 1 + testing/test_debugging.py | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 changelog/12497.contrib.rst diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9158d6bcc72..3131f487ab9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -147,7 +147,7 @@ jobs: - name: "ubuntu-py313" python: "3.13-dev" os: ubuntu-latest - tox_env: "py313" + tox_env: "py313-pexpect" use_coverage: true - name: "ubuntu-pypy3" python: "pypy-3.9" diff --git a/changelog/12497.contrib.rst b/changelog/12497.contrib.rst new file mode 100644 index 00000000000..ccf89731053 --- /dev/null +++ b/changelog/12497.contrib.rst @@ -0,0 +1 @@ +Fixed two failing pdb-related tests on Python 3.13. diff --git a/testing/test_debugging.py b/testing/test_debugging.py index 37032f92354..73a4b769ff7 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -768,9 +768,13 @@ def test_pdb_used_outside_test(self, pytester: Pytester) -> None: x = 5 """ ) + if sys.version_info[:2] >= (3, 13): + break_line = "pytest.set_trace()" + else: + break_line = "x = 5" child = pytester.spawn(f"{sys.executable} {p1}") - child.expect("x = 5") - child.expect("Pdb") + child.expect_exact(break_line) + child.expect_exact("Pdb") child.sendeof() self.flush(child) @@ -785,9 +789,13 @@ def test_foo(a): pass """ ) + if sys.version_info[:2] >= (3, 13): + break_line = "pytest.set_trace()" + else: + break_line = "x = 5" child = pytester.spawn_pytest(str(p1)) - child.expect("x = 5") - child.expect("Pdb") + child.expect_exact(break_line) + child.expect_exact("Pdb") child.sendeof() self.flush(child)