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