Merge lp:~mwhudson/launchpad/unconditionally-endInteraction-after-test into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Michael Hudson-Doyle |
Approved revision: | no longer in the source branch. |
Merged at revision: | 14107 |
Proposed branch: | lp:~mwhudson/launchpad/unconditionally-endInteraction-after-test |
Merge into: | lp:launchpad |
Diff against target: |
170 lines (+7/-36) 5 files modified
lib/canonical/launchpad/ftests/__init__.py (+0/-2) lib/canonical/testing/layers.py (+6/-8) lib/lp/testing/__init__.py (+0/-3) lib/lp/testing/_login.py (+1/-15) lib/lp/testing/tests/test_login.py (+0/-8) |
To merge this branch: | bzr merge lp:~mwhudson/launchpad/unconditionally-endInteraction-after-test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Kowalik (community) | code | Approve | |
Review via email: mp+78324@code.launchpad.net |
Commit message
[r=stevenk][no-qa] Unconditionally tear down the interaction after each test and remove weasel worded comments
Description of the change
While poking around how we handle logging in and out (aka setting up and tearing down interactions) in tests I noticed some weasel behaviour in layers.py:
# If tests forget to logout, we can do it for them.
if is_logged_in():
Well, this is just sucky: either we should unconditionally tear down the interaction, or we should fail tests that don't log out. The latter would make for a lot of cruft in doctests in particular, so let's just always log out.
Also, this only tears down interactions that have been set up by the specific test login helpers (that's what the is_logged_in() function is about). This is also daft: it's safe to call endInteraction() even if there is no interaction (maybe this wasn't always true), so let's just call that after every test.
This is the only use of the is_logged_in() function, so let's kill that and the global variable that drives it too.
This looks like excellent work, thank you!