##// END OF EJS Templates
strip ANSI colors from tracebacks when normalizing outputs
MinRK -
Show More
@@ -5,9 +5,6 b' Module with tests for the execute preprocessor.'
5 # Copyright (c) IPython Development Team.
5 # Copyright (c) IPython Development Team.
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7
7
8 #-----------------------------------------------------------------------------
9 # Imports
10 #-----------------------------------------------------------------------------
11 import copy
8 import copy
12 import os
9 import os
13 import re
10 import re
@@ -17,10 +14,11 b' from IPython.nbformat import current as nbformat'
17 from .base import PreprocessorTestsBase
14 from .base import PreprocessorTestsBase
18 from ..execute import ExecutePreprocessor
15 from ..execute import ExecutePreprocessor
19
16
17 from IPython.nbconvert.filters import strip_ansi
18
19
20 addr_pat = re.compile(r'0x[0-9a-f]{7,9}')
20
21
21 #-----------------------------------------------------------------------------
22 # Class
23 #-----------------------------------------------------------------------------
24
22
25 class TestExecute(PreprocessorTestsBase):
23 class TestExecute(PreprocessorTestsBase):
26 """Contains test functions for execute.py"""
24 """Contains test functions for execute.py"""
@@ -34,9 +32,15 b' class TestExecute(PreprocessorTestsBase):'
34 if 'metadata' in cell:
32 if 'metadata' in cell:
35 del cell['metadata']
33 del cell['metadata']
36 if 'text' in cell:
34 if 'text' in cell:
37 cell['text'] = re.sub('0x[0-9a-f]{7,9}', '<HEXADDR>', cell['text'])
35 cell['text'] = re.sub(addr_pat, '<HEXADDR>', cell['text'])
38 if 'svg' in cell:
36 if 'svg' in cell:
39 del cell['text']
37 del cell['text']
38 if 'traceback' in cell:
39 tb = []
40 for line in cell['traceback']:
41 tb.append(strip_ansi(line))
42 cell['traceback'] = tb
43
40 return cell
44 return cell
41
45
42
46
General Comments 0
You need to be logged in to leave comments. Login now