Skip to content

Commit 52135b0

Browse files
Merge pull request #12885 from The-Compiler/pdb-py311 (#12887)
Fix pdb selftests on Python 3.13 (cherry picked from commit a4e40bc) Co-authored-by: Florian Bruhin <[email protected]>
1 parent fb56f3d commit 52135b0

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
- name: "ubuntu-py313"
148148
python: "3.13-dev"
149149
os: ubuntu-latest
150-
tox_env: "py313"
150+
tox_env: "py313-pexpect"
151151
use_coverage: true
152152
- name: "ubuntu-pypy3"
153153
python: "pypy-3.9"

changelog/12497.contrib.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed two failing pdb-related tests on Python 3.13.

testing/test_debugging.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,13 @@ def test_pdb_used_outside_test(self, pytester: Pytester) -> None:
768768
x = 5
769769
"""
770770
)
771+
if sys.version_info[:2] >= (3, 13):
772+
break_line = "pytest.set_trace()"
773+
else:
774+
break_line = "x = 5"
771775
child = pytester.spawn(f"{sys.executable} {p1}")
772-
child.expect("x = 5")
773-
child.expect("Pdb")
776+
child.expect_exact(break_line)
777+
child.expect_exact("Pdb")
774778
child.sendeof()
775779
self.flush(child)
776780

@@ -785,9 +789,13 @@ def test_foo(a):
785789
pass
786790
"""
787791
)
792+
if sys.version_info[:2] >= (3, 13):
793+
break_line = "pytest.set_trace()"
794+
else:
795+
break_line = "x = 5"
788796
child = pytester.spawn_pytest(str(p1))
789-
child.expect("x = 5")
790-
child.expect("Pdb")
797+
child.expect_exact(break_line)
798+
child.expect_exact("Pdb")
791799
child.sendeof()
792800
self.flush(child)
793801

0 commit comments

Comments
 (0)