Merge lp:~thumper/launchpad/fix-features into lp:launchpad

Proposed by Tim Penhey on 2010-11-02
Status: Merged
Approved by: Robert Collins on 2010-11-02
Approved revision: not available
Merged at revision: 11831
Proposed branch: lp:~thumper/launchpad/fix-features
Merge into: lp:launchpad
Diff against target: 31 lines (+6/-1)
1 file modified
lib/lp/testing/__init__.py (+6/-1)
To merge this branch: bzr merge lp:~thumper/launchpad/fix-features
Reviewer Review Type Date Requested Status
Robert Collins (community) 2010-11-02 Approve on 2010-11-02
Review via email: mp+39819@code.launchpad.net

Commit Message

Explicitly flush the store when adding feature flags, and stop our tests from checking features for timeouts.

To post a comment you must log in.
Robert Collins (lifeless) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/testing/__init__.py'
2--- lib/lp/testing/__init__.py 2010-10-26 15:47:24 +0000
3+++ lib/lp/testing/__init__.py 2010-11-02 03:47:19 +0000
4@@ -107,6 +107,7 @@
5 canonical_url,
6 errorlog,
7 )
8+from canonical.launchpad.webapp.adapter import set_permit_timeout_from_features
9 from canonical.launchpad.webapp.errorlog import ErrorReportEvent
10 from canonical.launchpad.webapp.interaction import ANONYMOUS
11 from canonical.launchpad.webapp.servers import (
12@@ -495,6 +496,7 @@
13 self.oopses = []
14 self.useFixture(ZopeEventHandlerFixture(self._recordOops))
15 self.addCleanup(self.attachOopses)
16+ set_permit_timeout_from_features(False)
17
18 @adapter(ErrorReportEvent)
19 def _recordOops(self, event):
20@@ -992,7 +994,10 @@
21 assert getattr(features.per_thread, 'features', None) is not None
22 flag = FeatureFlag(
23 scope=scope, flag=name, value=value, priority=priority)
24- getFeatureStore().add(flag)
25+ store = getFeatureStore()
26+ store.add(flag)
27+ # Make sure that the feature is saved into the db right now.
28+ store.flush()
29
30
31 def validate_mock_class(mock_class):