Skip to content

Commit

Permalink
Merge pull request #631 from takluyver/test-norm-ipy-input-tb
Browse files Browse the repository at this point in the history
Normalise <ipython-input-...> in traceback in test
  • Loading branch information
takluyver committed Jul 27, 2017
2 parents e5ba024 + 16c8dbf commit ed682dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nbconvert/preprocessors/tests/test_execute.py
Expand Up @@ -24,6 +24,7 @@
from testpath import modified_env

addr_pat = re.compile(r'0x[0-9a-f]{7,9}')
ipython_input_pat = re.compile(r'<ipython-input-\d+-[0-9a-f]+>')
current_dir = os.path.dirname(__file__)

class TestExecute(PreprocessorTestsBase):
Expand All @@ -43,9 +44,10 @@ def normalize_output(output):
output['data']['text/plain'] = \
re.sub(addr_pat, '<HEXADDR>', output['data']['text/plain'])
if 'traceback' in output:
tb = []
for line in output['traceback']:
tb.append(strip_ansi(line))
tb = [
re.sub(ipython_input_pat, '<IPY-INPUT>', strip_ansi(line))
for line in output['traceback']
]
output['traceback'] = tb

return output
Expand Down

0 comments on commit ed682dc

Please sign in to comment.