kgashok / pymox

Automatically exported from code.google.com/p/pymox
Apache License 2.0
0 stars 0 forks source link

UnsetStubs doesn't work if stub is unused #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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()

2. 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.

Original issue reported on code.google.com by dcon...@gmail.com on 22 Sep 2008 at 3:55

GoogleCodeExporter commented 8 years ago
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.

Original comment by smidd...@gmail.com on 23 Sep 2008 at 12:04

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by smidd...@gmail.com on 20 Mar 2009 at 5:05