Merge lp:~cbrandily/python-fixtures/python-fixtures into lp:python-fixtures
Proposed by
Cedric Brandily
Status: | Needs review |
---|---|
Proposed branch: | lp:~cbrandily/python-fixtures/python-fixtures |
Merge into: | lp:python-fixtures |
Diff against target: |
48 lines (+19/-1) 2 files modified
fixtures/fixture.py (+1/-1) fixtures/tests/test_fixture.py (+18/-0) |
To merge this branch: | bzr merge lp:~cbrandily/python-fixtures/python-fixtures |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins | Disapprove | ||
Review via email: mp+259559@code.launchpad.net |
Description of the change
Ensure cleanups are called even if setUp fails with useFixture
This change ensures that a nested fixture cleanups will be called even if its setUp fails.
Example:
with MyFixture() as fixture1:
fixture1.
fixture2.cleanUp will be called in fixture1.__exit__ even if fixture2.setUp fails.
To post a comment you must log in.
Unmerged revisions
- 96. By Cedric Brandily
-
Ensure cleanups are called even if setUp fails with useFixture
This change ensures that a nested fixture cleanups will be called even if
its setUp fails.Example:
with MyFixture() as fixture1:
fixture1.useFixture( fixture2) fixture2.cleanUp will be called in fixture1.__exit__ even if
fixture2.setUp fails.
Thanks for this patch. Unfortunately this fixes the symptom not the problem- Fixtures are really just enhanced context managers, and so setUp == __enter__ - and to fix leaks we have to do it within setUp, not from the outside.
Additionally - and I'm sorry about this - you got mislead by the somewhat confusing thing of us having a mirror of the code here: the code is actually on github at https:/ /testing- cabal/fixtures. (LP does have a link to that but its not obvious - I hope I've made it clearer by editing the homepage a bit).