LaunchpadTestRequest should not always set features to NullFeatureController
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Brad Crittenden |
Bug Description
In a test, the following code did not work:
def test_a_view(self):
with person_
view = create_
html = view()
Because LaunchpadTestRe
NullFeatureCont
set up in the test, and preventing more flags from being configured.
In this instance the code worked when modified:
from lp.services.
def test_a_view(self):
with person_
view = create_
html = view()
In this instance it was the template that queried request.features, so
it was possible to poke a sensible feature controller into place
before it was needed. However, this would not have worked if the view
initialization code had looked at request.features.
I'm not aware of the rationale behind clobbering LTR.features in this
way, especially with a not very useful feature controller. We *need*
to be able to write tests for code that is activated by feature flags.
This might be a duplicate of bug 631884 depending on your point of
view.
I am marking this as High importance because trying to diagnose this
problem consumed well over 2h of developer time.
Related branches
- Данило Шеган (community): Approve
-
Diff: 60 lines (+7/-12)2 files modifiedlib/canonical/launchpad/webapp/servers.py (+6/-3)
lib/lp/registry/browser/tests/test_subscription_links.py (+1/-9)
Changed in launchpad: | |
status: | Triaged → In Progress |
assignee: | nobody → Brad Crittenden (bac) |
tags: |
added: qa-untestable removed: qa-needstesting |
Changed in launchpad: | |
status: | Fix Committed → Fix Released |
I think NullFeatureCont roller was quite possibly a mistake on my part
(specifically leftover tdd scaffolding), and if someone tackles this
please think about killing it entirely.
Martin