Merge lp:~larstiq/bzr/xdg-config into lp:bzr

Proposed by Wouter van Heyst
Status: Superseded
Proposed branch: lp:~larstiq/bzr/xdg-config
Merge into: lp:bzr
Diff against target: 122 lines (+23/-25)
4 files modified
bzrlib/i18n.py (+5/-6)
bzrlib/tests/__init__.py (+1/-0)
bzrlib/tests/test_setup.py (+14/-19)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~larstiq/bzr/xdg-config
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+104078@code.launchpad.net

This proposal has been superseded by a proposal from 2012-04-30.

Description of the change

Make sure the XDG_CONFIG_HOME environment variable doesn't leak into any test.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/i18n.py'
2--- bzrlib/i18n.py 2011-12-19 13:23:58 +0000
3+++ bzrlib/i18n.py 2012-04-30 10:00:30 +0000
4@@ -136,19 +136,18 @@
5
6 :param base: plugins can specify their own local directory
7 """
8- if hasattr(sys, 'frozen'):
9+ fs_enc = sys.getfilesystemencoding()
10+ if getattr(sys, 'frozen', False):
11 if base is None:
12- base = os.path.dirname(
13- unicode(sys.executable, sys.getfilesystemencoding()))
14+ base = os.path.dirname(unicode(sys.executable, fs_enc))
15 return os.path.join(base, u'locale')
16 else:
17 if base is None:
18- base = os.path.dirname(unicode(__file__, sys.getfilesystemencoding()))
19+ base = os.path.dirname(unicode(__file__, fs_enc))
20 dirpath = os.path.realpath(os.path.join(base, u'locale'))
21 if os.path.exists(dirpath):
22 return dirpath
23- else:
24- return '/usr/share/locale'
25+ return os.path.join(unicode(sys.prefix, fs_enc), u"share", u"locale")
26
27
28 def _check_win32_locale():
29
30=== modified file 'bzrlib/tests/__init__.py'
31--- bzrlib/tests/__init__.py 2012-03-13 09:07:18 +0000
32+++ bzrlib/tests/__init__.py 2012-04-30 10:00:30 +0000
33@@ -137,6 +137,7 @@
34 isolated_environ = {
35 'BZR_HOME': None,
36 'HOME': None,
37+ 'XDG_CONFIG_HOME': None,
38 # bzr now uses the Win32 API and doesn't rely on APPDATA, but the
39 # tests do check our impls match APPDATA
40 'BZR_EDITOR': None, # test_msgeditor manipulates this variable
41
42=== modified file 'bzrlib/tests/test_setup.py'
43--- bzrlib/tests/test_setup.py 2011-01-12 01:01:53 +0000
44+++ bzrlib/tests/test_setup.py 2012-04-30 10:00:30 +0000
45@@ -21,19 +21,15 @@
46 import subprocess
47
48 import bzrlib
49-from bzrlib.tests import TestCase, TestSkipped
50-import bzrlib.osutils as osutils
51+from bzrlib import tests
52
53-# XXX: This clobbers the build directory in the real source tree; it'd be nice
54-# to avoid that.
55-#
56 # TODO: Run bzr from the installed copy to see if it works. Really we need to
57 # run something that exercises every module, just starting it may not detect
58 # some missing modules.
59 #
60 # TODO: Check that the version numbers are in sync. (Or avoid this...)
61
62-class TestSetup(TestCase):
63+class TestSetup(tests.TestCaseInTempDir):
64
65 def test_build_and_install(self):
66 """ test cmd `python setup.py build`
67@@ -45,30 +41,29 @@
68 # are not necessarily invoked from there
69 self.source_dir = os.path.dirname(os.path.dirname(bzrlib.__file__))
70 if not os.path.isfile(os.path.join(self.source_dir, 'setup.py')):
71- raise TestSkipped(
72+ self.skip(
73 'There is no setup.py file adjacent to the bzrlib directory')
74 try:
75 import distutils.sysconfig
76 makefile_path = distutils.sysconfig.get_makefile_filename()
77 if not os.path.exists(makefile_path):
78- raise TestSkipped(
79+ self.skip(
80 'You must have the python Makefile installed to run this'
81 ' test. Usually this can be found by installing'
82 ' "python-dev"')
83 except ImportError:
84- raise TestSkipped(
85+ self.skip(
86 'You must have distutils installed to run this test.'
87 ' Usually this can be found by installing "python-dev"')
88- self.log('test_build running in %s' % os.getcwd())
89- root_dir = osutils.mkdtemp()
90- try:
91- self.run_setup(['clean'])
92- # build is implied by install
93- ## self.run_setup(['build'])
94- self.run_setup(['install', '--root', root_dir])
95- self.run_setup(['clean'])
96- finally:
97- osutils.rmtree(root_dir)
98+ self.log('test_build running from %s' % self.source_dir)
99+ build_dir = os.path.join(self.test_dir, "build")
100+ install_dir = os.path.join(self.test_dir, "install")
101+ self.run_setup([
102+ 'build', '-b', build_dir,
103+ 'install', '--root', install_dir])
104+ # Install layout is platform dependant
105+ self.assertPathExists(install_dir)
106+ self.run_setup(['clean', '-b', build_dir])
107
108 def run_setup(self, args):
109 args = [sys.executable, './setup.py', ] + args
110
111=== modified file 'doc/en/release-notes/bzr-2.5.txt'
112--- doc/en/release-notes/bzr-2.5.txt 2012-04-16 11:08:11 +0000
113+++ doc/en/release-notes/bzr-2.5.txt 2012-04-30 10:00:30 +0000
114@@ -77,6 +77,9 @@
115 * Add support for pyftpdlib >= 0.7.0 and drop support for previous pyftpdlib
116 versions. (Vincent Ladeuil, #956027)
117
118+* Run smoketest for setup.py isolated in a tempdir. (Martin Packman, #140874)
119+
120+
121 bzr 2.5.0
122 #########
123