/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

Rework test_script a little bit.


Don't allow someone to request a stdin request to echo.
Echo never reads from stdin, it just echos its arguments.
You use 'cat' if you want to read from stdin.

A few other fixes because the tests were using filenames
that are actually illegal on Windows, rather than just
nonexistant.


Change the exception handling for commands so that
unknown errors don't get silently squashed and then
turn into hard-to-debug errors later.

test_script now passes on Windows.

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