Rev 4822: * TestCaseWithMemoryTransport no longer sets $HOME and $BZR_HOME to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 24 03:19:42 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4822 [merge]
revision-id: pqm at pqm.ubuntu.com-20091124031941-4r6i483d98o4eytw
parent: pqm at pqm.ubuntu.com-20091123234216-gwx0g4nd22xw247y
parent: michael.hudson at canonical.com-20091124022523-0pism3bgkg0ip73t
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-11-24 03:19:41 +0000
message:
  * TestCaseWithMemoryTransport no longer sets $HOME and $BZR_HOME to
  	unicode strings. (Michael Hudson, #464174)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
=== modified file 'NEWS'
--- a/NEWS	2009-11-20 16:42:28 +0000
+++ b/NEWS	2009-11-24 02:23:01 +0000
@@ -60,6 +60,8 @@
 Testing
 *******
 
+* TestCaseWithMemoryTransport no longer sets $HOME and $BZR_HOME to
+  unicode strings. (Michael Hudson, #464174)
 
 bzr 2.0.3 (not released yet)
 ############################

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-11-18 16:10:18 +0000
+++ b/bzrlib/tests/__init__.py	2009-11-23 01:23:08 +0000
@@ -2475,8 +2475,11 @@
         return branchbuilder.BranchBuilder(branch=branch)
 
     def overrideEnvironmentForTesting(self):
-        os.environ['HOME'] = self.test_home_dir
-        os.environ['BZR_HOME'] = self.test_home_dir
+        test_home_dir = self.test_home_dir
+        if isinstance(test_home_dir, unicode):
+            test_home_dir = test_home_dir.encode(sys.getfilesystemencoding())
+        os.environ['HOME'] = test_home_dir
+        os.environ['BZR_HOME'] = test_home_dir
 
     def setUp(self):
         super(TestCaseWithMemoryTransport, self).setUp()

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2009-11-08 04:44:23 +0000
+++ b/bzrlib/tests/test_selftest.py	2009-11-24 02:25:23 +0000
@@ -516,6 +516,14 @@
         cwd = osutils.getcwd()
         self.assertIsSameRealPath(self.test_dir, cwd)
 
+    def test_BZR_HOME_and_HOME_are_bytestrings(self):
+        """The $BZR_HOME and $HOME environment variables should not be unicode.
+
+        See https://bugs.launchpad.net/bzr/+bug/464174
+        """
+        self.assertIsInstance(os.environ['BZR_HOME'], str)
+        self.assertIsInstance(os.environ['HOME'], str)
+
     def test_make_branch_and_memory_tree(self):
         """In TestCaseWithMemoryTransport we should not make the branch on disk.
 




More information about the bazaar-commits mailing list