##// END OF EJS Templates
Revive doctest_tb_sysexit...
Nikita Kniazev -
Show More
@@ -8,7 +8,7 b' def div0():'
8 x/y
8 x/y
9
9
10 def sysexit(stat, mode):
10 def sysexit(stat, mode):
11 raise SystemExit(stat, 'Mode = %s' % mode)
11 raise SystemExit(stat, f'Mode = {mode}')
12
12
13 def bar(mode):
13 def bar(mode):
14 "bar"
14 "bar"
@@ -118,91 +118,83 b' def doctest_tb_verbose():'
118 """
118 """
119
119
120
120
121 # TODO : Marc 2021 – this seem to fail due
121 def doctest_tb_sysexit():
122 # to upstream changes in CI for whatever reason.
122 """
123 # Commenting for now, to revive someday (maybe?)
123 In [17]: %xmode plain
124 # nose won't work in 3.10 anyway and we'll have to disable iptest.
124 Exception reporting mode: Plain
125 # thus this likely need to bemigrated to pytest.
125
126
126 In [18]: %run simpleerr.py exit
127
127 An exception has occurred, use %tb to see the full traceback.
128 # def doctest_tb_sysexit():
128 SystemExit: (1, 'Mode = exit')
129 # """
129
130 # In [17]: %xmode plain
130 In [19]: %run simpleerr.py exit 2
131 # Exception reporting mode: Plain
131 An exception has occurred, use %tb to see the full traceback.
132 #
132 SystemExit: (2, 'Mode = exit')
133 # In [18]: %run simpleerr.py exit
133
134 # An exception has occurred, use %tb to see the full traceback.
134 In [20]: %tb
135 # SystemExit: (1, 'Mode = exit')
135 Traceback (most recent call last):
136 #
136 File ... in <module>
137 # In [19]: %run simpleerr.py exit 2
137 bar(mode)
138 # An exception has occurred, use %tb to see the full traceback.
138 File ... line 22, in bar
139 # SystemExit: (2, 'Mode = exit')
139 sysexit(stat, mode)
140 #
140 File ... line 11, in sysexit
141 # In [20]: %tb
141 raise SystemExit(stat, f'Mode = {mode}')
142 # Traceback (most recent call last):
142 SystemExit: (2, 'Mode = exit')
143 # File ... in <module>
143
144 # bar(mode)
144 In [21]: %xmode context
145 # File ... line 22, in bar
145 Exception reporting mode: Context
146 # sysexit(stat, mode)
146
147 # File ... line 11, in sysexit
147 In [22]: %tb
148 # raise SystemExit(stat, 'Mode = %s' % mode)
148 ---------------------------------------------------------------------------
149 # SystemExit: (2, 'Mode = exit')
149 SystemExit Traceback (most recent call last)
150 #
150 <BLANKLINE>
151 # In [21]: %xmode context
151 ...<module>
152 # Exception reporting mode: Context
152 29 except IndexError:
153 #
153 30 mode = 'div'
154 # In [22]: %tb
154 ---> 32 bar(mode)
155 # ---------------------------------------------------------------------------
155 <BLANKLINE>
156 # SystemExit Traceback (most recent call last)
156 ...bar(mode)
157 # <BLANKLINE>
157 20 except:
158 # ...<module>
158 21 stat = 1
159 # 29 except IndexError:
159 ---> 22 sysexit(stat, mode)
160 # 30 mode = 'div'
160 23 else:
161 # ---> 32 bar(mode)
161 24 raise ValueError('Unknown mode')
162 # <BLANKLINE>
162 <BLANKLINE>
163 # ...bar(mode)
163 ...sysexit(stat, mode)
164 # 20 except:
164 10 def sysexit(stat, mode):
165 # 21 stat = 1
165 ---> 11 raise SystemExit(stat, f'Mode = {mode}')
166 # ---> 22 sysexit(stat, mode)
166 <BLANKLINE>
167 # 23 else:
167 SystemExit: (2, 'Mode = exit')
168 # 24 raise ValueError('Unknown mode')
168
169 # <BLANKLINE>
169 In [23]: %xmode verbose
170 # ...sysexit(stat, mode)
170 Exception reporting mode: Verbose
171 # 10 def sysexit(stat, mode):
171
172 # ---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
172 In [24]: %tb
173 # <BLANKLINE>
173 ---------------------------------------------------------------------------
174 # SystemExit: (2, 'Mode = exit')
174 SystemExit Traceback (most recent call last)
175 #
175 <BLANKLINE>
176 # In [23]: %xmode verbose
176 ... in <module>
177 # Exception reporting mode: Verbose
177 29 except IndexError:
178 #
178 30 mode = 'div'
179 # In [24]: %tb
179 ---> 32 bar(mode)
180 # ---------------------------------------------------------------------------
180 mode = 'exit'
181 # SystemExit Traceback (most recent call last)
181 <BLANKLINE>
182 # <BLANKLINE>
182 ... in bar(mode='exit')
183 # ... in <module>
183 20 except:
184 # 29 except IndexError:
184 21 stat = 1
185 # 30 mode = 'div'
185 ---> 22 sysexit(stat, mode)
186 # ---> 32 bar(mode)
186 mode = 'exit'
187 # mode = 'exit'
187 stat = 2
188 # <BLANKLINE>
188 23 else:
189 # ... in bar(mode='exit')
189 24 raise ValueError('Unknown mode')
190 # 20 except:
190 <BLANKLINE>
191 # 21 stat = 1
191 ... in sysexit(stat=2, mode='exit')
192 # ---> 22 sysexit(stat, mode)
192 10 def sysexit(stat, mode):
193 # mode = 'exit'
193 ---> 11 raise SystemExit(stat, f'Mode = {mode}')
194 # stat = 2
194 stat = 2
195 # 23 else:
195 <BLANKLINE>
196 # 24 raise ValueError('Unknown mode')
196 SystemExit: (2, 'Mode = exit')
197 # <BLANKLINE>
197 """
198 # ... in sysexit(stat=2, mode='exit')
199 # 10 def sysexit(stat, mode):
200 # ---> 11 raise SystemExit(stat, 'Mode = %s' % mode)
201 # stat = 2
202 # mode = 'exit'
203 # <BLANKLINE>
204 # SystemExit: (2, 'Mode = exit')
205 # """
206
198
207
199
208 def test_run_cell():
200 def test_run_cell():
General Comments 0
You need to be logged in to leave comments. Login now