MockerTestCase fails to call restore when there's an exception
Bug #628385 reported by
John Evans
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mocker |
Invalid
|
Undecided
|
Unassigned |
Bug Description
This causes cascading test failures because objects that have been .replace'd in one test are still (bad leftover) mocks in subsequent tests.
See the attached patch for a fix.
To post a comment you must log in.
This should not be necessary, because the method is wrapped in this logic:
def run_wrapper(*args, **kwargs):
return run_method(*args, **kwargs)
finally:
self. __cleanup( )
try:
self.__cleanup() will call mocker.reset(), which does the restoring.
If you believe there's a problem in this logic, can you please provide a test case which demonstrates the problem?