Python Mock type only within module
===

I am using mock for testing in Python. I am trying to unit test a metaclass which overwrites the `__new__` method and then calls `type.__new__(cls)` internally.

I don't want to actually call `type.__new__`, so I want to mock out `type`. Of course, I can't patch `__builtin__.type` because it breaks object construction within the test.

So, I really want to limit mocking `type` within the module under test. Is this possible?