summaryrefslogtreecommitdiff
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-02-27 00:12:43 +0000
committerBrett Cannon <bcannon@gmail.com>2007-02-27 00:12:43 +0000
commit44c526174d9296ce358ccee9652382e7ea5377f4 (patch)
treeb73f7e9b78a8ff681ebd64386a165cafdc5ddfd3 /Lib/test/test_traceback.py
parentdfb2a8a7c176b4db246a6f32bdf4a1b079bdd4eb (diff)
downloadcpython-git-44c526174d9296ce358ccee9652382e7ea5377f4.tar.gz
Tweak the fix for test_traceback since the fix for it to run on its own broke
it under regrtest. 'traceback' likes to strip out the module name if it is __main__ or __builtin__ but not in other cases.
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 51fb9e64a5..1b9e2f8b6b 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -118,7 +118,11 @@ def test():
err = traceback.format_exception_only(X, X())
self.assertEqual(len(err), 1)
str_value = '<unprintable %s object>' % X.__name__
- self.assertEqual(err[0], "%s: %s\n" % ( X.__name__, str_value))
+ if X.__module__ in ('__main__', '__builtin__'):
+ str_name = X.__name__
+ else:
+ str_name = '.'.join([X.__module__, X.__name__])
+ self.assertEqual(err[0], "%s: %s\n" % (str_name, str_value))
def test_without_exception(self):
err = traceback.format_exception_only(None, None)