/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_version_info.py

  • Committer: Vincent Ladeuil
  • Date: 2009-09-02 08:26:27 UTC
  • mto: (4669.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4670.
  • Revision ID: v.ladeuil+lp@free.fr-20090902082627-cit8vm6tefu9hwk2
Cleanup emacs-bzr-send-XXXXXX.el leaks in /tmp during selftest.

* tests/test_mail_client.py:
(TestEmacsMail.test_commandline,
TestEmacsMail.test_commandline_is_8bit): Cleanup the generated tmp
file.

* mail_client.py:
(EmacsMail.__init__, EmacsMail._get_compose_commandline): Keep
track of the tmp file to ease cleanup during testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
    errors,
26
 
    registry,
27
26
    symbol_versioning,
28
27
    tests,
29
28
    version_info_formats,
326
325
 
327
326
    def setUp(self):
328
327
        super(TestVersionInfoFormatRegistry, self).setUp()
329
 
        self.overrideAttr(version_info_formats,
330
 
                          'format_registry', registry.Registry())
 
328
        registry = version_info_formats.format_registry
 
329
        self._default_key = registry._default_key
 
330
        self._dict = registry._dict.copy()
 
331
        self._help_dict = registry._help_dict.copy()
 
332
        self._info_dict = registry._info_dict.copy()
 
333
        self.addCleanup(self._cleanup)
 
334
 
 
335
    def _cleanup(self):
 
336
        # Restore the registry to pristine state after the test runs
 
337
        registry = version_info_formats.format_registry
 
338
        registry._default_key = self._default_key
 
339
        registry._dict = self._dict
 
340
        registry._help_dict = self._help_dict
 
341
        registry._info_dict = self._info_dict
331
342
 
332
343
    def test_register_remove(self):
333
344
        registry = version_info_formats.format_registry