File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 27
27
from .base import NBClientTestsBase
28
28
29
29
addr_pat = re .compile (r'0x[0-9a-f]{7,9}' )
30
- ipython_input_pat = re .compile (r'<ipython-input-\d+-[0-9a-f]+>' )
31
30
current_dir = os .path .dirname (__file__ )
31
+ ipython_input_pat = re .compile (r'<ipython-input-\d+-[0-9a-f]+>' )
32
+ # Tracebacks look different in IPython 8,
33
+ # see: https://github.com/ipython/ipython/blob/master/docs/source/whatsnew/version8.rst#traceback-improvements # noqa
34
+ ipython8_input_pat = re .compile (r'Input In \[\d+\],' )
32
35
33
36
34
37
class AsyncMock (Mock ):
@@ -201,10 +204,11 @@ def normalize_output(output):
201
204
if isinstance (value , string_types ):
202
205
output ['data' ][key ] = normalize_base64 (value )
203
206
if 'traceback' in output :
204
- tb = [
205
- re .sub (ipython_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
206
- for line in output ['traceback' ]
207
- ]
207
+ tb = []
208
+ for line in output ["traceback" ]:
209
+ line = re .sub (ipython_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
210
+ line = re .sub (ipython8_input_pat , '<IPY-INPUT>' , strip_ansi (line ))
211
+ tb .append (line )
208
212
output ['traceback' ] = tb
209
213
210
214
return output
You can’t perform that action at this time.
0 commit comments