← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mbp/launchpad/feature-install-cleanup into lp:launchpad

 

Martin Pool has proposed merging lp:~mbp/launchpad/feature-install-cleanup into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~mbp/launchpad/feature-install-cleanup/+merge/60279

test_distroseries seems to have its own implementation of one of the featureflag test fixtures; this makes it use the standard one.

tested with './bin/test -m test_distroseries'.
-- 
https://code.launchpad.net/~mbp/launchpad/feature-install-cleanup/+merge/60279
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/feature-install-cleanup into lp:launchpad.
=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py	2011-05-05 20:51:47 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py	2011-05-07 15:06:40 +0000
@@ -52,13 +52,15 @@
 from lp.services.features import (
     get_relevant_feature_controller,
     getFeatureFlag,
-    install_feature_controller,
     )
 from lp.services.features.flags import FeatureController
 from lp.services.features.model import (
     FeatureFlag,
     getFeatureStore,
     )
+from lp.services.features.testing import (
+    FeatureFixture,
+    )
 from lp.soyuz.enums import (
     ArchivePermissionType,
     PackagePublishingStatus,
@@ -86,18 +88,9 @@
 
 
 def set_derived_series_ui_feature_flag(test_case):
-    # Helper to set the feature flag enabling the derived series ui.
-    getFeatureStore().add(FeatureFlag(
-        scope=u'default', flag=u'soyuz.derived-series-ui.enabled',
-        value=u'on', priority=1))
-
-    # XXX Michael Nelson 2010-09-21 bug=631884
-    # Currently LaunchpadTestRequest doesn't set per-thread
-    # features.
-    def in_scope(value):
-        return True
-    install_feature_controller(FeatureController(in_scope))
-    test_case.addCleanup(install_feature_controller, None)
+    test_case.useFixture(FeatureFixture({
+        u'soyuz.derived-series-ui.enabled': 'on',
+        }))
 
 
 class TestDistroSeriesView(TestCaseWithFactory):

=== modified file 'lib/lp/services/features/__init__.py'
--- lib/lp/services/features/__init__.py	2011-03-29 00:11:57 +0000
+++ lib/lp/services/features/__init__.py	2011-05-07 15:06:40 +0000
@@ -222,4 +222,5 @@
     from lp.services.features.scopes import ScopesForScript
 
     return FeatureController(
-        ScopesForScript(script_name).lookup, StormFeatureRuleSource())
+        ScopesForScript(script_name),
+        StormFeatureRuleSource())