MockerTestCase fails to call restore when there's an exception

Bug #628385 reported by John Evans
6
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.

Revision history for this message
John Evans (lgastako) wrote :
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

This should not be necessary, because the method is wrapped in this logic:

        def run_wrapper(*args, **kwargs):
            try:
                return run_method(*args, **kwargs)
            finally:
                self.__cleanup()

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?

Changed in mocker:
status: New → Incomplete
Revision history for this message
John Evans (lgastako) wrote :

You are correct. I created a simplified test case to reproduce the issue we were encountering and was unable to reproduce it, so the problem must lie elsewhere in our test code. Sorry for the false alarm.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

No problem.

Changed in mocker:
status: Incomplete → Invalid
Revision history for this message
John Evans (lgastako) wrote :

BTW, Mocker is a great tool. We love it. Good work! :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.