Merge lp:~mwhudson/bzr/bytestring-environment-variables into lp:bzr

Proposed by Michael Hudson-Doyle
Status: Superseded
Proposed branch: lp:~mwhudson/bzr/bytestring-environment-variables
Merge into: lp:bzr
Diff against target: 17 lines (+5/-2)
1 file modified
bzrlib/tests/__init__.py (+5/-2)
To merge this branch: bzr merge lp:~mwhudson/bzr/bytestring-environment-variables
Reviewer Review Type Date Requested Status
Robert Collins (community) Needs Fixing
Review via email: mp+15113@code.launchpad.net

This proposal has been superseded by a proposal from 2009-11-23.

Commit message

(mwhudson) encode TREE_ROOT with the file system encoding

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

As mentioned in the bug report, $BZR_HOME and $HOME are unicode strings in tests now, and this upsets some things (and I think it's just true, good or bad, that environment variables are bytestrings). This is one possible fix; I'm not sure if it's a good or bad one.

Revision history for this message
Robert Collins (lifeless) wrote :

I think its fine to make the environment strings be fs encoded; however changing in memory objects is a different question.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/__init__.py'
2--- bzrlib/tests/__init__.py 2009-11-18 16:10:18 +0000
3+++ bzrlib/tests/__init__.py 2009-11-23 01:27:11 +0000
4@@ -2475,8 +2475,11 @@
5 return branchbuilder.BranchBuilder(branch=branch)
6
7 def overrideEnvironmentForTesting(self):
8- os.environ['HOME'] = self.test_home_dir
9- os.environ['BZR_HOME'] = self.test_home_dir
10+ test_home_dir = self.test_home_dir
11+ if isinstance(test_home_dir, unicode):
12+ test_home_dir = test_home_dir.encode(sys.getfilesystemencoding())
13+ os.environ['HOME'] = test_home_dir
14+ os.environ['BZR_HOME'] = test_home_dir
15
16 def setUp(self):
17 super(TestCaseWithMemoryTransport, self).setUp()