Skip to content

Commit

Permalink
Backport PR #12874: fixup release note and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Mar 27, 2021
1 parent 89905c0 commit d46f6b0
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 89 deletions.
183 changes: 95 additions & 88 deletions IPython/core/tests/test_iplib.py
Expand Up @@ -123,94 +123,101 @@ def doctest_tb_verbose():
ZeroDivisionError: ...
"""

def doctest_tb_sysexit():
"""
In [17]: %xmode plain
Exception reporting mode: Plain
In [18]: %run simpleerr.py exit
An exception has occurred, use %tb to see the full traceback.
SystemExit: (1, 'Mode = exit')
In [19]: %run simpleerr.py exit 2
An exception has occurred, use %tb to see the full traceback.
SystemExit: (2, 'Mode = exit')
In [20]: %tb
Traceback (most recent call last):
File ... in <module>
bar(mode)
File ... line 22, in bar
sysexit(stat, mode)
File ... line 11, in sysexit
raise SystemExit(stat, 'Mode = %s' % mode)
SystemExit: (2, 'Mode = exit')
In [21]: %xmode context
Exception reporting mode: Context
In [22]: %tb
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<BLANKLINE>
...<module>
30 mode = 'div'
31
---> 32 bar(mode)
<BLANKLINE>
...bar(mode)
20 except:
21 stat = 1
---> 22 sysexit(stat, mode)
23 else:
24 raise ValueError('Unknown mode')
<BLANKLINE>
...sysexit(stat, mode)
9
10 def sysexit(stat, mode):
---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
12
13 def bar(mode):
<BLANKLINE>
SystemExit: (2, 'Mode = exit')
In [23]: %xmode verbose
Exception reporting mode: Verbose
In [24]: %tb
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<BLANKLINE>
... in <module>
30 mode = 'div'
31
---> 32 bar(mode)
global bar = <function bar at ...>
global mode = 'exit'
<BLANKLINE>
... in bar(mode='exit')
20 except:
21 stat = 1
---> 22 sysexit(stat, mode)
global sysexit = <function sysexit at ...>
stat = 2
mode = 'exit'
23 else:
24 raise ValueError('Unknown mode')
<BLANKLINE>
... in sysexit(stat=2, mode='exit')
9
10 def sysexit(stat, mode):
---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
global SystemExit = undefined
stat = 2
mode = 'exit'
12
13 def bar(mode):
<BLANKLINE>
SystemExit: (2, 'Mode = exit')
"""

# TODO : Marc 2021 – this seem to fail due
# to upstream changes in CI for whatever reason.
# Commenting for now, to revive someday (maybe?)
# nose won't work in 3.10 anyway and we'll have to disable iptest.
# thus this likely need to bemigrated to pytest.

# warning this test differs between 7.x and 8+ branch.

# def doctest_tb_sysexit():
# """
# In [17]: %xmode plain
# Exception reporting mode: Plain
#
# In [18]: %run simpleerr.py exit
# An exception has occurred, use %tb to see the full traceback.
# SystemExit: (1, 'Mode = exit')
#
# In [19]: %run simpleerr.py exit 2
# An exception has occurred, use %tb to see the full traceback.
# SystemExit: (2, 'Mode = exit')
#
# In [20]: %tb
# Traceback (most recent call last):
# File ... in <module>
# bar(mode)
# File ... line 22, in bar
# sysexit(stat, mode)
# File ... line 11, in sysexit
# raise SystemExit(stat, 'Mode = %s' % mode)
# SystemExit: (2, 'Mode = exit')
#
# In [21]: %xmode context
# Exception reporting mode: Context
#
# In [22]: %tb
# ---------------------------------------------------------------------------
# SystemExit Traceback (most recent call last)
# <BLANKLINE>
# ...<module>
# 30 mode = 'div'
# 31
# ---> 32 bar(mode)
# <BLANKLINE>
# ...bar(mode)
# 20 except:
# 21 stat = 1
# ---> 22 sysexit(stat, mode)
# 23 else:
# 24 raise ValueError('Unknown mode')
# <BLANKLINE>
# ...sysexit(stat, mode)
# 9
# 10 def sysexit(stat, mode):
# ---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
# 12
# 13 def bar(mode):
# <BLANKLINE>
# SystemExit: (2, 'Mode = exit')
#
# In [23]: %xmode verbose
# Exception reporting mode: Verbose
#
# In [24]: %tb
# ---------------------------------------------------------------------------
# SystemExit Traceback (most recent call last)
# <BLANKLINE>
# ... in <module>
# 30 mode = 'div'
# 31
# ---> 32 bar(mode)
# global bar = <function bar at ...>
# global mode = 'exit'
# <BLANKLINE>
# ... in bar(mode='exit')
# 20 except:
# 21 stat = 1
# ---> 22 sysexit(stat, mode)
# global sysexit = <function sysexit at ...>
# stat = 2
# mode = 'exit'
# 23 else:
# 24 raise ValueError('Unknown mode')
# <BLANKLINE>
# ... in sysexit(stat=2, mode='exit')
# 9
# 10 def sysexit(stat, mode):
# ---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
# global SystemExit = undefined
# stat = 2
# mode = 'exit'
# 12
# 13 def bar(mode):
# <BLANKLINE>
# SystemExit: (2, 'Mode = exit')
# """

def test_run_cell():
import textwrap
Expand Down
12 changes: 11 additions & 1 deletion docs/source/whatsnew/version7.rst
Expand Up @@ -7,6 +7,16 @@
IPython 7.22
============

Second release of IPython for 2021, mostly containing bug fixes. Here is a quick
rundown of the few changes.

- Fix some ``sys.excepthook`` shenanigan when embedding with qt, recommended if
you – for example – use `napari <https://napari.org>`__. :ghpull:`12842`.
- Fix bug when using the new ipdb ``%context`` magic :ghpull:`12844`
- Couples of deprecation cleanup :ghpull:`12868`
- Update for new dpast.com api if you use the ``%pastbin`` magic. :ghpull:`12712`
- Remove support for numpy before 1.16. :ghpull:`12836`


Thanks
------
Expand All @@ -18,7 +28,7 @@ codebase; they now have triage permissions to the IPython repository and we'll
work toward giving them more permission in the future.

Many thanks to all the contributors to this release you can find all individual
contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/XX>`__.
contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/84>`__.

Thanks as well to organisations, QuantStack for working on debugger
compatibility for Xeus_python, and the `D. E. Shaw group
Expand Down

0 comments on commit d46f6b0

Please sign in to comment.