Export to GitHub

pymox - issue #1

UnsetStubs doesn't work if stub is unused


Posted on Sep 22, 2008 by Quick Wombat

What steps will reproduce the problem? 1. Create a test with e.g.

self.mox = mox.Mox() self.mox.StubOutWithMock(module_under_test.logging, 'info') ...

other code that doesn't use module.logging

... self.mox.UnsetStubs()

  1. Run the test

What is the expected output? What do you see instead?

I would expect the UnsetStubs call (probably in a tearDown method or similar) to return module_under_test.logging to its original state. Instead, all my other tests start failing.

Inserting the line: module_under_test.logging.info(mox.IsA(str) just after StubOutWithMock causes the issue to disappear.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Comment #1

Posted on Sep 23, 2008 by Massive Panda

Hm, I'm unable to reproduce this with a simple example. What errors are you getting from your other tests? Are you sure that you are always calling UnsetStubs? Can you create a small example that reproduces this?

Attached as is a simple module under test, and some tests that pass.

Attachments

Comment #2

Posted on Mar 20, 2009 by Massive Panda

(No comment was entered for this change.)

Status: Invalid

Labels:
Type-Defect Priority-Medium