that xmode skip frames Not as a doctest as pytest does not run doctests.
()
| 323 | |
| 324 | @skip_win32 |
| 325 | def test_xmode_skip(): |
| 326 | """that xmode skip frames |
| 327 | |
| 328 | Not as a doctest as pytest does not run doctests. |
| 329 | """ |
| 330 | import pexpect |
| 331 | |
| 332 | env = os.environ.copy() |
| 333 | env["IPY_TEST_SIMPLE_PROMPT"] = "1" |
| 334 | |
| 335 | child = pexpect.spawn( |
| 336 | sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env |
| 337 | ) |
| 338 | child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE |
| 339 | |
| 340 | child.expect("IPython") |
| 341 | child.expect("\n") |
| 342 | child.expect_exact("In [1]") |
| 343 | |
| 344 | block = dedent( |
| 345 | """ |
| 346 | def f(): |
| 347 | __tracebackhide__ = True |
| 348 | g() |
| 349 | |
| 350 | def g(): |
| 351 | raise ValueError |
| 352 | |
| 353 | f() |
| 354 | """ |
| 355 | ) |
| 356 | |
| 357 | for line in block.splitlines(): |
| 358 | child.sendline(line) |
| 359 | child.expect_exact(line) |
| 360 | child.expect_exact("skipping") |
| 361 | |
| 362 | block = dedent( |
| 363 | """ |
| 364 | def f(): |
| 365 | __tracebackhide__ = True |
| 366 | g() |
| 367 | |
| 368 | def g(): |
| 369 | from IPython.core.debugger import set_trace |
| 370 | set_trace() |
| 371 | |
| 372 | f() |
| 373 | """ |
| 374 | ) |
| 375 | |
| 376 | for line in block.splitlines(): |
| 377 | child.sendline(line) |
| 378 | child.expect_exact(line) |
| 379 | |
| 380 | child.expect("ipdb>") |
| 381 | child.sendline("w") |
| 382 | child.expect("hidden") |