File: 0004-fix-stack-data-0.6-failing-tests.patch

package info (click to toggle)
ipython 8.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,184 kB
  • sloc: python: 36,444; sh: 407; makefile: 243
file content (162 lines) | stat: -rw-r--r-- 5,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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