Message267162
So its a feature of mock that it can mock a module that doesn't exist. And the semantics of the import system are designed to be very cheap when a module is already imported - so when 'patchbug.a' is in sys.modules, import will correctly return it rather than going out to the import path to find if its the same thing.
We could possibly have an opt-in check on mock.patch to require that the thing being patched exists, but it would have to be opt-in as so many cases are dealing with optional or pretend instances. I'm not super keen on that though.
This is perhaps worth calling out in the docs to avoid confusion. |
|
Date |
User |
Action |
Args |
2016-06-03 21:04:32 | rbcollins | set | recipients:
+ rbcollins, clarkbreyman |
2016-06-03 21:04:32 | rbcollins | set | messageid: <1464987872.51.0.666150388947.issue27197@psf.upfronthosting.co.za> |
2016-06-03 21:04:32 | rbcollins | link | issue27197 messages |
2016-06-03 21:04:32 | rbcollins | create | |
|