From: Matthias Bussonnier <bussonniermatthias@gmail.com>
Date: Sun, 30 Oct 2022 09:10:13 +0100
Subject: fix stack-data 0.6 failing tests

---
 IPython/core/tests/test_iplib.py | 132 +++++++++++++++++++++++++--------------
 1 file changed, 85 insertions(+), 47 deletions(-)

diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py
index 14474bb..a264df5 100644
--- a/IPython/core/tests/test_iplib.py
+++ b/IPython/core/tests/test_iplib.py
@@ -1,17 +1,9 @@
 """Tests for the key interactiveshell module, where the main ipython class is defined.
 """
-#-----------------------------------------------------------------------------
-# Module imports
-#-----------------------------------------------------------------------------
+import stack_data
 
-# third party
-import pytest
+SV_VERSION = tuple([int(x) for x in stack_data.__version__.split(".")[0:2]])
 
-# our own packages
-
-#-----------------------------------------------------------------------------
-# Test functions
-#-----------------------------------------------------------------------------
 
 def test_reset():
     """reset must clear most namespaces."""
@@ -172,46 +164,92 @@ def doctest_tb_sysexit():
     """
 
 
-def doctest_tb_sysexit_verbose():
-    """
-    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')
+if SV_VERSION < (0, 6):
 
-    In [23]: %xmode verbose
-    Exception reporting mode: Verbose
+    def doctest_tb_sysexit_verbose_stack_data_05():
+        """
+        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 [23]: %xmode verbose
+        Exception reporting mode: Verbose
+
+        In [24]: %tb
+        ---------------------------------------------------------------------------
+        SystemExit                                Traceback (most recent call last)
+        <BLANKLINE>
+        ...
+            30     except IndexError:
+            31         mode = 'div'
+        ---> 33     bar(mode)
+                mode = 'exit'
+        <BLANKLINE>
+        ... in bar(mode='exit')
+            ...     except:
+            ...         stat = 1
+        ---> ...     sysexit(stat, mode)
+                mode = 'exit'
+                stat = 2
+            ...     else:
+            ...         raise ValueError('Unknown mode')
+        <BLANKLINE>
+        ... in sysexit(stat=2, mode='exit')
+            10 def sysexit(stat, mode):
+        ---> 11     raise SystemExit(stat, f"Mode = {mode}")
+                stat = 2
+        <BLANKLINE>
+        SystemExit: (2, 'Mode = exit')
+        """
 
-    In [24]: %tb
-    ---------------------------------------------------------------------------
-    SystemExit                                Traceback (most recent call last)
-    <BLANKLINE>
-    ...
-         30     except IndexError:
-         31         mode = 'div'
-    ---> 33     bar(mode)
-            mode = 'exit'
-    <BLANKLINE>
-    ... in bar(mode='exit')
-         ...     except:
-         ...         stat = 1
-    ---> ...     sysexit(stat, mode)
-            mode = 'exit'
-            stat = 2
-         ...     else:
-         ...         raise ValueError('Unknown mode')
-    <BLANKLINE>
-    ... in sysexit(stat=2, mode='exit')
-         10 def sysexit(stat, mode):
-    ---> 11     raise SystemExit(stat, f"Mode = {mode}")
-            stat = 2
-    <BLANKLINE>
-    SystemExit: (2, 'Mode = exit')
-    """
+else:
+    # currently the only difference is
+    # + mode = 'exit'
 
+    def doctest_tb_sysexit_verbose_stack_data_06():
+        """
+        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 [23]: %xmode verbose
+        Exception reporting mode: Verbose
+
+        In [24]: %tb
+        ---------------------------------------------------------------------------
+        SystemExit                                Traceback (most recent call last)
+        <BLANKLINE>
+        ...
+            30     except IndexError:
+            31         mode = 'div'
+        ---> 33     bar(mode)
+                mode = 'exit'
+        <BLANKLINE>
+        ... in bar(mode='exit')
+            ...     except:
+            ...         stat = 1
+        ---> ...     sysexit(stat, mode)
+                mode = 'exit'
+                stat = 2
+            ...     else:
+            ...         raise ValueError('Unknown mode')
+        <BLANKLINE>
+        ... in sysexit(stat=2, mode='exit')
+            10 def sysexit(stat, mode):
+        ---> 11     raise SystemExit(stat, f"Mode = {mode}")
+                stat = 2
+                mode = 'exit'
+        <BLANKLINE>
+        SystemExit: (2, 'Mode = exit')
+        """
 
 def test_run_cell():
     import textwrap
