~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_library_state.py

  • Committer: Vincent Ladeuil
  • Date: 2011-10-03 14:34:45 UTC
  • mto: This revision was merged to the branch mainline in revision 6185.
  • Revision ID: v.ladeuil+lp@free.fr-20111003143445-s382csvk1613x0sp
Remove the warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for BzrLibraryState."""
18
18
 
19
 
import bzrlib
20
19
from bzrlib import (
21
 
    config,
22
20
    library_state,
23
21
    tests,
24
 
    trace,
25
22
    ui as _mod_ui
26
23
    )
27
24
from bzrlib.tests import fixtures
52
49
        finally:
53
50
            state.__exit__(None, None, None)
54
51
            self.assertEqual(['__enter__', '__exit__'], tracer._calls)
55
 
 
56
 
    def test_warns_if_not_called(self):
57
 
        self.overrideAttr(bzrlib, 'global_state', None)
58
 
        warnings = []
59
 
        def warning(*args):
60
 
            warnings.append(args[0] % args[1:])
61
 
        self.overrideAttr(trace, 'warning', warning)
62
 
        # Querying for a an option requires a real global_state or emits a
63
 
        # warning
64
 
        c = config.GlobalStack()
65
 
        v = c.get('whatever')
66
 
        self.assertLength(1, warnings)
67
 
        self.assertEquals("You forgot to use 'with bzrlib.initialize():'",
68
 
                          warnings[0])