Message248500
I also posted in stackoverflow: http://stackoverflow.com/questions/30978207/python-urlopen-mock-fail
```
from unittest.mock import patch
import urllib
from urllib import request
from urllib.request import urlopen
@patch('urllib.request.urlopen')
def openPatch(urlopenMock):
print(urlopenMock)
print(urlopen)
print(request.urlopen)
print(urllib.request.urlopen)
openPatch()
```
and got
```
<MagicMock name='urlopen' id='140645541554384'>
<function urlopen at 0x7fea9764c268>
<MagicMock name='urlopen' id='140645541554384'>
<MagicMock name='urlopen' id='140645541554384'>
```
request.urlopen and urllib.request.urlopen worked. Why urlopen had been not mocked? |
|
Date |
User |
Action |
Args |
2015-08-13 06:56:17 | sih4sing5hong5 | set | recipients:
+ sih4sing5hong5 |
2015-08-13 06:56:17 | sih4sing5hong5 | set | messageid: <1439448977.69.0.239329434858.issue24855@psf.upfronthosting.co.za> |
2015-08-13 06:56:17 | sih4sing5hong5 | link | issue24855 messages |
2015-08-13 06:56:17 | sih4sing5hong5 | create | |
|