/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_library_state.py

  • Committer: Robert Collins
  • Date: 2010-06-25 06:23:08 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625062308-qx287gzfrehs1d21
Restore the original ui_factory when existing BzrLibraryState.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib import (
21
21
    library_state,
22
22
    tests,
 
23
    ui as _mod_ui
23
24
    )
24
25
 
25
26
 
26
 
class TestLibraryState(tests.TestCase):
 
27
# TODO: once sufficiently cleaned up this should be able to be TestCase.
 
28
class TestLibraryState(tests.TestCaseWithTransport):
27
29
 
28
 
    pass
 
30
    def test_ui_is_used(self):
 
31
        ui = _mod_ui.SilentUIFactory()
 
32
        state = library_state.BzrLibraryState(ui=ui)
 
33
        orig_ui = _mod_ui.ui_factory
 
34
        state.__enter__()
 
35
        try:
 
36
            self.assertEqual(ui, _mod_ui.ui_factory)
 
37
        finally:
 
38
            state.__exit__(None, None, None)
 
39
            self.assertEqual(orig_ui, _mod_ui.ui_factory)