[Python-3000-checkins] r53978 - python/branches/p3yk/Lib/test/test_traceback.py

brett.cannon python-3000-checkins at python.org
Tue Feb 27 01:12:45 CET 2007


Author: brett.cannon
Date: Tue Feb 27 01:12:43 2007
New Revision: 53978

Modified:
   python/branches/p3yk/Lib/test/test_traceback.py
Log:
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.


Modified: python/branches/p3yk/Lib/test/test_traceback.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_traceback.py	(original)
+++ python/branches/p3yk/Lib/test/test_traceback.py	Tue Feb 27 01:12:43 2007
@@ -118,7 +118,11 @@
         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)


More information about the Python-3000-checkins mailing list