##// END OF EJS Templates
Merge pull request #13702 from Carreau/mdocs...
Matthias Bussonnier -
r27692:35918166 merge
parent child
Show More
@@ -368,7 +368,7 Currently the magic system has the following functions:""",
368
368
369 If called without arguments, acts as a toggle.
369 If called without arguments, acts as a toggle.
370
370
371 When in verbose mode the value --show (and --hide)
371 When in verbose mode the value `--show` (and `--hide`)
372 will respectively show (or hide) frames with ``__tracebackhide__ =
372 will respectively show (or hide) frames with ``__tracebackhide__ =
373 True`` value set.
373 True`` value set.
374 """
374 """
@@ -369,6 +369,7 def _decorator_skip_setup():
369
369
370 env = os.environ.copy()
370 env = os.environ.copy()
371 env["IPY_TEST_SIMPLE_PROMPT"] = "1"
371 env["IPY_TEST_SIMPLE_PROMPT"] = "1"
372 env["PROMPT_TOOLKIT_NO_CPR"] = "1"
372
373
373 child = pexpect.spawn(
374 child = pexpect.spawn(
374 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
375 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
@@ -379,6 +380,7 def _decorator_skip_setup():
379 child.expect("\n")
380 child.expect("\n")
380
381
381 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
382 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
383 child.str_last_chars = 500
382
384
383 dedented_blocks = [dedent(b).strip() for b in skip_decorators_blocks]
385 dedented_blocks = [dedent(b).strip() for b in skip_decorators_blocks]
384 in_prompt_number = 1
386 in_prompt_number = 1
@@ -392,18 +394,22 def _decorator_skip_setup():
392 return child
394 return child
393
395
394
396
397 @pytest.mark.skip(reason="recently fail for unknown reason on CI")
395 @skip_win32
398 @skip_win32
396 def test_decorator_skip():
399 def test_decorator_skip():
397 """test that decorator frames can be skipped."""
400 """test that decorator frames can be skipped."""
398
401
399 child = _decorator_skip_setup()
402 child = _decorator_skip_setup()
400
403
404 child.expect_exact("ipython-input-8")
401 child.expect_exact("3 bar(3, 4)")
405 child.expect_exact("3 bar(3, 4)")
402 child.expect("ipdb>")
406 child.expect("ipdb>")
403
407
404 child.expect("ipdb>")
408 child.expect("ipdb>")
405 child.sendline("step")
409 child.sendline("step")
406 child.expect_exact("step")
410 child.expect_exact("step")
411 child.expect_exact("--Call--")
412 child.expect_exact("ipython-input-6")
407
413
408 child.expect_exact("1 @pdb_skipped_decorator")
414 child.expect_exact("1 @pdb_skipped_decorator")
409
415
@@ -413,6 +419,7 def test_decorator_skip():
413 child.close()
419 child.close()
414
420
415
421
422 @pytest.mark.skip(reason="recently fail for unknown reason on CI")
416 @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="issues on PyPy")
423 @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="issues on PyPy")
417 @skip_win32
424 @skip_win32
418 def test_decorator_skip_disabled():
425 def test_decorator_skip_disabled():
@@ -450,11 +457,13 def test_decorator_skip_with_breakpoint():
450
457
451 env = os.environ.copy()
458 env = os.environ.copy()
452 env["IPY_TEST_SIMPLE_PROMPT"] = "1"
459 env["IPY_TEST_SIMPLE_PROMPT"] = "1"
460 env["PROMPT_TOOLKIT_NO_CPR"] = "1"
453
461
454 child = pexpect.spawn(
462 child = pexpect.spawn(
455 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
463 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
456 )
464 )
457 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
465 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
466 child.str_last_chars = 500
458
467
459 child.expect("IPython")
468 child.expect("IPython")
460 child.expect("\n")
469 child.expect("\n")
@@ -20,6 +20,11 from prompt_toolkit import __version__ as ptk_version
20 PTK3 = ptk_version.startswith('3.')
20 PTK3 = ptk_version.startswith('3.')
21
21
22
22
23 # we want to avoid ptk as much as possible when using subprocesses
24 # as it uses cursor positioning requests, deletes color ....
25 _use_simple_prompt = "IPY_TEST_SIMPLE_PROMPT" in os.environ
26
27
23 class TerminalPdb(Pdb):
28 class TerminalPdb(Pdb):
24 """Standalone IPython debugger."""
29 """Standalone IPython debugger."""
25
30
@@ -87,8 +92,9 class TerminalPdb(Pdb):
87 if not PTK3:
92 if not PTK3:
88 options['inputhook'] = self.shell.inputhook
93 options['inputhook'] = self.shell.inputhook
89 options.update(pt_session_options)
94 options.update(pt_session_options)
90 self.pt_loop = asyncio.new_event_loop()
95 if not _use_simple_prompt:
91 self.pt_app = PromptSession(**options)
96 self.pt_loop = asyncio.new_event_loop()
97 self.pt_app = PromptSession(**options)
92
98
93 def cmdloop(self, intro=None):
99 def cmdloop(self, intro=None):
94 """Repeatedly issue a prompt, accept input, parse an initial prefix
100 """Repeatedly issue a prompt, accept input, parse an initial prefix
@@ -121,10 +127,15 class TerminalPdb(Pdb):
121 self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals
127 self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals
122
128
123 # Run the prompt in a different thread.
129 # Run the prompt in a different thread.
124 try:
130 if not _use_simple_prompt:
125 line = self.thread_executor.submit(self.pt_app.prompt).result()
131 try:
126 except EOFError:
132 line = self.thread_executor.submit(
127 line = "EOF"
133 self.pt_app.prompt
134 ).result()
135 except EOFError:
136 line = "EOF"
137 else:
138 line = input("ipdb> ")
128
139
129 line = self.precmd(line)
140 line = self.precmd(line)
130 stop = self.onecmd(line)
141 stop = self.onecmd(line)
@@ -1,10 +1,10
1 .. _ipython_as_shell:
2
1
3 .. note::
2 .. note::
4
3
5 This page has been kept for historical reason. You most likely want to use
4 This page has been kept for historical reason. You most likely want to use
6 `Xonsh <https://xon.sh/>`__ instead of this.
5 `Xonsh <https://xon.sh/>`__ instead of this.
7
6
7 .. _ipython_as_shell:
8
8
9 =========================
9 =========================
10 IPython as a system shell
10 IPython as a system shell
@@ -241,6 +241,7 such that it allows autoplay.
241 the HTML allowing it. It also could get blocked by some browser extensions.
241 the HTML allowing it. It also could get blocked by some browser extensions.
242
242
243 Try it out!
243 Try it out!
244
244 ::
245 ::
245
246
246 In [1]: from IPython.display import YouTubeVideo
247 In [1]: from IPython.display import YouTubeVideo
@@ -1368,7 +1369,6 Miscellaneous
1368 IPython 7.3.0
1369 IPython 7.3.0
1369 =============
1370 =============
1370
1371
1371 .. _whatsnew720:
1372
1372
1373 IPython 7.3.0 bring several bug fixes and small improvements that you will
1373 IPython 7.3.0 bring several bug fixes and small improvements that you will
1374 described bellow.
1374 described bellow.
@@ -1393,6 +1393,8 Misc bug fixes and improvements:
1393 - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528`
1393 - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528`
1394 - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529`
1394 - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529`
1395
1395
1396 .. _whatsnew720:
1397
1396 IPython 7.2.0
1398 IPython 7.2.0
1397 =============
1399 =============
1398
1400
@@ -1423,8 +1425,7 and we're now proud to have code contributed by Chris in IPython.
1423 OSMagics.cd_force_quiet configuration option
1425 OSMagics.cd_force_quiet configuration option
1424 --------------------------------------------
1426 --------------------------------------------
1425
1427
1426 You can set this option to force the %cd magic to behave as if ``-q`` was passed:
1428 You can set this option to force the %cd magic to behave as if ``-q`` was passed::
1427 ::
1428
1429
1429 In [1]: cd /
1430 In [1]: cd /
1430 /
1431 /
General Comments 0
You need to be logged in to leave comments. Login now