##// END OF EJS Templates
fix stack-data 0.6 failing tests
Matthias Bussonnier -
Show More
@@ -1,15 +1,10 b''
1 """Tests for the key interactiveshell module, where the main ipython class is defined.
1 """Tests for the key interactiveshell module, where the main ipython class is defined.
2 """
2 """
3 #-----------------------------------------------------------------------------
4 # Module imports
5 #-----------------------------------------------------------------------------
6
3
4 import stack_data
7
5
8 # our own packages
6 SV_VERSION = tuple([int(x) for x in stack_data.__version__.split(".")[0:2]])
9
7
10 #-----------------------------------------------------------------------------
11 # Test functions
12 #-----------------------------------------------------------------------------
13
8
14 def test_reset():
9 def test_reset():
15 """reset must clear most namespaces."""
10 """reset must clear most namespaces."""
@@ -170,46 +165,92 b' def doctest_tb_sysexit():'
170 """
165 """
171
166
172
167
173 def doctest_tb_sysexit_verbose():
168 if SV_VERSION < (0, 6):
174 """
175 In [18]: %run simpleerr.py exit
176 An exception has occurred, use %tb to see the full traceback.
177 SystemExit: (1, 'Mode = exit')
178
169
179 In [19]: %run simpleerr.py exit 2
170 def doctest_tb_sysexit_verbose_stack_data_05():
180 An exception has occurred, use %tb to see the full traceback.
171 """
181 SystemExit: (2, 'Mode = exit')
172 In [18]: %run simpleerr.py exit
173 An exception has occurred, use %tb to see the full traceback.
174 SystemExit: (1, 'Mode = exit')
175
176 In [19]: %run simpleerr.py exit 2
177 An exception has occurred, use %tb to see the full traceback.
178 SystemExit: (2, 'Mode = exit')
179
180 In [23]: %xmode verbose
181 Exception reporting mode: Verbose
182
183 In [24]: %tb
184 ---------------------------------------------------------------------------
185 SystemExit Traceback (most recent call last)
186 <BLANKLINE>
187 ...
188 30 except IndexError:
189 31 mode = 'div'
190 ---> 33 bar(mode)
191 mode = 'exit'
192 <BLANKLINE>
193 ... in bar(mode='exit')
194 ... except:
195 ... stat = 1
196 ---> ... sysexit(stat, mode)
197 mode = 'exit'
198 stat = 2
199 ... else:
200 ... raise ValueError('Unknown mode')
201 <BLANKLINE>
202 ... in sysexit(stat=2, mode='exit')
203 10 def sysexit(stat, mode):
204 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
205 stat = 2
206 <BLANKLINE>
207 SystemExit: (2, 'Mode = exit')
208 """
182
209
183 In [23]: %xmode verbose
210 else:
184 Exception reporting mode: Verbose
211 # currently the only difference is
185
212 # + mode = 'exit'
186 In [24]: %tb
187 ---------------------------------------------------------------------------
188 SystemExit Traceback (most recent call last)
189 <BLANKLINE>
190 ...
191 30 except IndexError:
192 31 mode = 'div'
193 ---> 33 bar(mode)
194 mode = 'exit'
195 <BLANKLINE>
196 ... in bar(mode='exit')
197 ... except:
198 ... stat = 1
199 ---> ... sysexit(stat, mode)
200 mode = 'exit'
201 stat = 2
202 ... else:
203 ... raise ValueError('Unknown mode')
204 <BLANKLINE>
205 ... in sysexit(stat=2, mode='exit')
206 10 def sysexit(stat, mode):
207 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
208 stat = 2
209 <BLANKLINE>
210 SystemExit: (2, 'Mode = exit')
211 """
212
213
214 def doctest_tb_sysexit_verbose_stack_data_06():
215 """
216 In [18]: %run simpleerr.py exit
217 An exception has occurred, use %tb to see the full traceback.
218 SystemExit: (1, 'Mode = exit')
219
220 In [19]: %run simpleerr.py exit 2
221 An exception has occurred, use %tb to see the full traceback.
222 SystemExit: (2, 'Mode = exit')
223
224 In [23]: %xmode verbose
225 Exception reporting mode: Verbose
226
227 In [24]: %tb
228 ---------------------------------------------------------------------------
229 SystemExit Traceback (most recent call last)
230 <BLANKLINE>
231 ...
232 30 except IndexError:
233 31 mode = 'div'
234 ---> 33 bar(mode)
235 mode = 'exit'
236 <BLANKLINE>
237 ... in bar(mode='exit')
238 ... except:
239 ... stat = 1
240 ---> ... sysexit(stat, mode)
241 mode = 'exit'
242 stat = 2
243 ... else:
244 ... raise ValueError('Unknown mode')
245 <BLANKLINE>
246 ... in sysexit(stat=2, mode='exit')
247 10 def sysexit(stat, mode):
248 ---> 11 raise SystemExit(stat, f"Mode = {mode}")
249 stat = 2
250 mode = 'exit'
251 <BLANKLINE>
252 SystemExit: (2, 'Mode = exit')
253 """
213
254
214 def test_run_cell():
255 def test_run_cell():
215 import textwrap
256 import textwrap
General Comments 0
You need to be logged in to leave comments. Login now