##// 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 5 # Copyright (c) IPython Development Team.
6 6 # Distributed under the terms of the Modified BSD License.
7 7
8 #-----------------------------------------------------------------------------
9 # Imports
10 #-----------------------------------------------------------------------------
11 8 import copy
12 9 import os
13 10 import re
@@ -17,10 +14,11 b' from IPython.nbformat import current as nbformat'
17 14 from .base import PreprocessorTestsBase
18 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 23 class TestExecute(PreprocessorTestsBase):
26 24 """Contains test functions for execute.py"""
@@ -34,9 +32,15 b' class TestExecute(PreprocessorTestsBase):'
34 32 if 'metadata' in cell:
35 33 del cell['metadata']
36 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 36 if 'svg' in cell:
39 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 44 return cell
41 45
42 46
General Comments 0
You need to be logged in to leave comments. Login now