diff options
author | ankitjavalkar | 2017-02-17 17:33:25 +0530 |
---|---|---|
committer | ankitjavalkar | 2017-02-17 17:33:25 +0530 |
commit | 9bedcd25c823561f9a499f47fabd5f7c436be6e6 (patch) | |
tree | 0b69bf19b7802576b965e1d6e640638c1417cb08 /yaksh | |
parent | 85412e8f77a268590cf8ca6f6cd6facd8fdc3c2c (diff) | |
download | online_test-9bedcd25c823561f9a499f47fabd5f7c436be6e6.tar.gz online_test-9bedcd25c823561f9a499f47fabd5f7c436be6e6.tar.bz2 online_test-9bedcd25c823561f9a499f47fabd5f7c436be6e6.zip |
Remove filename strings from error traceback in python assertion
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 77efbc1..c8f2dd0 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -83,12 +83,15 @@ class PythonAssertionEvaluator(BaseEvaluator): err_tb_lines = traceback.format_exc().splitlines() stripped_tb_lines = [] for line in err_tb_lines: - if '.py' not in line: - stripped_tb_lines.append(line) + line = re.sub(r'File\s+".*?",\s+line', + 'File <file>, line', + line + ) + stripped_tb_lines.append(line) stripped_tb = '\n'.join(stripped_tb_lines[-10::]) err = "Expected Test Case:\n{0}\n" \ - "Error Traceback- {1} {2} in:\n {3}\n{4}".format( + "Error Traceback - {1} {2} in:\n {3}\n{4}".format( self.test_case, type.__name__, str(value), |