summaryrefslogtreecommitdiff
path: root/QMTest
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-02-28 08:45:05 -0800
committerWilliam Deegan <bill@baddogconsulting.com>2017-02-28 08:45:05 -0800
commitb6d5c41ccb0ddd7848be67241535f50966b738a8 (patch)
tree40e53abc583161589b86929e5ab4e295cb21a32a /QMTest
parent10874015f880147c03970114a6684bb0584b7c79 (diff)
downloadscons-b6d5c41ccb0ddd7848be67241535f50966b738a8.tar.gz
Replace calling traceback to get format of traceback output to just a formatted string as the frmat is stable and we're not supporting older versions of python whose formats varied. The traceback approach broke with py3 and is honestly overcomplicated
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestSCons.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 80499309..e7175fbf 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -563,21 +563,26 @@ class TestSCons(TestCommon):
Returns a Python error line for output comparisons.
The exec of the traceback line gives us the correct format for
- this version of Python. Before 2.5, this yielded:
-
- File "<string>", line 1, ?
-
- Python 2.5 changed this to:
+ this version of Python.
File "<string>", line 1, <module>
We stick the requested file name and line number in the right
places, abstracting out the version difference.
"""
- exec('import traceback; x = traceback.format_stack()[-1]')
- x = x.lstrip()
- x = x.replace('<string>', file)
- x = x.replace('line 1,', 'line %s,' % line)
+ # This routine used to use traceback to get the proper format
+ # that doesn't work well with py3. And the format of the
+ # traceback seems to be stable, so let's just format
+ # an appropriate string
+ #
+ #exec('import traceback; x = traceback.format_stack()[-1]')
+ # import traceback
+ # x = traceback.format_stack()
+ # x = # XXX: .lstrip()
+ # x = x.replace('<string>', file)
+ # x = x.replace('line 1,', 'line %s,' % line)
+ # x="\n".join(x)
+ x='File "%s", line %s, in <module>\n'%(file,line)
return x
def normalize_ps(self, s):