Closed blampe closed 10 years ago
I don't think this is an issue with testify at all. It has to do with mock.patch
and names: http://www.voidspace.org.uk/python/mock/patch.html#where-to-patch).
You're accessing self.Herp().function()
, but you're patching a different name.
Note that there is a stdlib module named 'test' so the magical str-to-object machinery of mock.patch(str)
may be getting confused there. mock.patch.object
is less fuzzy in that regard.
I believe that's exactly what's happening; testify adds the $PWD to the python-path, while plain-old python does not, therefore 'import test' will give you a different module in each case. Further, in the second case, the module's name is __main__
rather than test
.
notabug
Crazy edge case. Save this to test.py:
Testify:
Python: