Merge lp:~jr/bzr/i18n-fix-tests into lp:bzr

Proposed by Jonathan Riddell
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6132
Proposed branch: lp:~jr/bzr/i18n-fix-tests
Merge into: lp:bzr
Diff against target: 45 lines (+3/-7)
2 files modified
bzrlib/tests/__init__.py (+3/-0)
bzrlib/tests/test_transport.py (+0/-7)
To merge this branch: bzr merge lp:~jr/bzr/i18n-fix-tests
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+75037@code.launchpad.net

Commit message

Do not use i18n for tests

Description of the change

do not use i18n in tests

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Yup, more like it. Some docstrings are probably missing on some functions there as I had to read a fair chunk of the file to catch-up with the modifications done since I last looked at it ;)

review: Approve
Revision history for this message
Jonathan Riddell (jr) wrote :

sent to pqm by email

Revision history for this message
Martin Pool (mbp) wrote :

perhaps adding a section about i18n to testing.txt would be good?

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 2011-09-12 09:51:52 +0000
3+++ bzrlib/tests/__init__.py 2011-09-12 16:36:01 +0000
4@@ -61,6 +61,7 @@
5 chk_map,
6 commands as _mod_commands,
7 config,
8+ i18n,
9 debug,
10 errors,
11 hooks,
12@@ -1005,6 +1006,8 @@
13 self._counters = {}
14 if 'config_stats' in selftest_debug_flags:
15 self._install_config_stats_hooks()
16+ # Do not use i18n for tests (unless the test reverses this)
17+ self.overrideAttr(i18n, 'installed', lambda: True)
18
19 def debug(self):
20 # debug a frame up.
21
22=== modified file 'bzrlib/tests/test_transport.py'
23--- bzrlib/tests/test_transport.py 2011-09-12 14:28:03 +0000
24+++ bzrlib/tests/test_transport.py 2011-09-12 16:36:01 +0000
25@@ -52,12 +52,6 @@
26 class TestTransport(tests.TestCase):
27 """Test the non transport-concrete class functionality."""
28
29- def ignore_i18n(self):
30- """Some tests end up using i18n when that will break things
31- (e.g. if config can no longer be read)"""
32- from bzrlib import i18n
33- i18n.install = lambda: None
34-
35 def test__get_set_protocol_handlers(self):
36 handlers = transport._get_protocol_handlers()
37 self.assertNotEqual([], handlers.keys())
38@@ -89,7 +83,6 @@
39
40 def test_transport_dependency(self):
41 """Transport with missing dependency causes no error"""
42- self.ignore_i18n()
43 saved_handlers = transport._get_protocol_handlers()
44 self.addCleanup(transport._set_protocol_handlers, saved_handlers)
45 # don't pollute the current handlers