Rev 163: Prevent test suite from causing default-encoding changes in file:///home/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Mon Mar 19 15:57:16 GMT 2007


At file:///home/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 163
revision-id: abentley at panoramicfeedback.com-20070307194122-pg1tkm7p94xsyi3y
parent: abentley at panoramicfeedback.com-20070307135823-xh9j5khud9h16v0v
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: gtk
timestamp: Wed 2007-03-07 14:41:22 -0500
message:
  Prevent test suite from causing default-encoding changes
modified:
  __init__.py                    __init__.py-20060519165329-a1fd52c8a829fcd5
=== modified file '__init__.py'
--- a/__init__.py	2007-03-07 13:58:23 +0000
+++ b/__init__.py	2007-03-07 19:41:22 +0000
@@ -435,6 +435,12 @@
 def test_suite():
     from unittest import TestSuite
     import tests
-    result = TestSuite()
-    result.addTest(tests.test_suite())
+    import sys
+    default_encoding = sys.getdefaultencoding()
+    try:
+        result = TestSuite()
+        result.addTest(tests.test_suite())
+    finally:
+        reload(sys)
+        sys.setdefaultencoding(default_encoding)
     return result




More information about the bazaar-commits mailing list