|
7 | 7 | import os |
8 | 8 | import os.path |
9 | 9 | import re |
| 10 | +import readline |
10 | 11 | import subprocess |
11 | 12 | import sys |
12 | 13 | import textwrap |
@@ -6243,10 +6244,11 @@ def check_completions(): |
6243 | 6244 |
|
6244 | 6245 |
|
6245 | 6246 | @pytest.mark.xfail( |
6246 | | - (3, 11) < sys.version_info < (3, 12, 12), |
6247 | | - reason="Broken on 3.12 before 3.12.12", |
| 6247 | + (((3, 9) < sys.version_info < (3, 11)) and "libedit" in readline.__doc__), |
| 6248 | + reason="Flaky, depending on the readline implementation (GNU readline vs libedit) ", |
6248 | 6249 | ) |
6249 | 6250 | def test_nested_completer(testdir): |
| 6251 | + has_libedit = "libedit" in readline.__doc__ |
6250 | 6252 | p1 = testdir.makepyfile( |
6251 | 6253 | """ |
6252 | 6254 | import sys |
@@ -6279,24 +6281,24 @@ class Config(DefaultConfig): |
6279 | 6281 | testdir.monkeypatch.setenv("PDBPP_COLORS", "0") |
6280 | 6282 | child = testdir.spawn(f"{quote(sys.executable)} {str(p1)}", expect_timeout=1) |
6281 | 6283 | child.send("completeme\t") |
6282 | | - if sys.version_info < (3, 14): |
6283 | | - child.expect_exact("\r\n(Pdb++) completeme_outer") |
6284 | | - else: |
| 6284 | + if has_libedit: |
6285 | 6285 | child.expect_exact("\r\n(Pdb++) completeme\x07\r\x1b[19G_outer") |
| 6286 | + else: |
| 6287 | + child.expect_exact("\r\n(Pdb++) completeme_outer") |
6286 | 6288 | child.send("\nimport pdbpp; _p = pdbpp.Pdb(); _p.reset()") |
6287 | 6289 | child.send("\n_p.interaction(frames[0], None)\n") |
6288 | 6290 | child.expect_exact("\r\n-> frames.append(sys._getframe())\r\n(Pdb++) ") |
6289 | 6291 | child.send("completeme\t") |
6290 | | - if sys.version_info < (3, 14): |
6291 | | - child.expect_exact("completeme_inner") |
6292 | | - else: |
| 6292 | + if has_libedit: |
6293 | 6293 | child.expect_exact("completeme\x07\r\x1b[19G_inner") |
| 6294 | + else: |
| 6295 | + child.expect_exact("completeme_inner") |
6294 | 6296 | child.send("\nq\n") |
6295 | 6297 | child.send("completeme\t") |
6296 | | - if sys.version_info < (3, 14): |
6297 | | - child.expect_exact("completeme_outer") |
6298 | | - else: |
| 6298 | + if has_libedit: |
6299 | 6299 | child.expect_exact("completeme\x07\r\x1b[19G_outer") |
| 6300 | + else: |
| 6301 | + child.expect_exact("completeme_outer") |
6300 | 6302 | child.send("\n") |
6301 | 6303 | child.sendeof() |
6302 | 6304 |
|
|
0 commit comments