~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/features/tests/test_flags.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-02 23:44:26 UTC
  • mfrom: (13589.1.1 revert-r13574)
  • Revision ID: launchpad@pqm.canonical.com-20110802234426-z03j07sj334l9ay0
[r=wgrant][rollback=13574] Revert r13574. It crashes when the flag is
 enabled, see bug #810290.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Tests for feature flags."""
10
10
 
11
11
from canonical.testing import layers
12
12
from lp.services.features import (
13
 
    UseFeatureController,
14
13
    getFeatureFlag,
15
14
    install_feature_controller,
16
15
    )
118
117
        # the start-of-request handler will do something like this:
119
118
        controller, call_log = self.makeControllerInScopes(
120
119
            ['default', 'beta_user'])
121
 
        with UseFeatureController(controller):
 
120
        install_feature_controller(controller)
 
121
        try:
122
122
            # then application code can simply ask without needing a context
123
123
            # object
124
124
            self.assertEqual(u'4.0', getFeatureFlag('ui.icing'))
 
125
        finally:
 
126
            install_feature_controller(None)
125
127
 
126
128
    def test_threadGetFlagNoContext(self):
127
129
        # If there is no context, please don't crash. workaround for the root