Metaclass exception when accessing headers attribute of a requests response
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CaptureMock |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Given the following program:
```
(capturemock)
from capturemock import capturemock
@capturemock(
def do_stuff():
import requests
resp = requests.get("http://
print(resp)
print(
do_stuff()
```
```
(capturemock)
<Response [200]>
CaseInsensitive
```
works fine but if setting CAPTUREMOCK_MODE=1, it fails:
```
(capturemock)
<Response [200]>
Traceback (most recent call last):
File "test.py", line 12, in <module>
do_stuff()
File "/Users/
result = func(*funcargs, **funckw)
File "test.py", line 9, in do_stuff
print(
File "/Users/
return self.__
File "/Users/
self.
File "/Users/
return self.getAndReco
File "/Users/
return self.transformR
File "/Users/
responseText, transformedResponse = traffic.
File "/Users/
transformed
File "/Users/
return transformMethod
File "/Users/
return result.
File "/Users/
return proxy.captureMo
File "/Users/
newClass = self.captureMoc
File "/Users/
return self.defineClas
File "/Users/
self.
File "/Users/
exec(
File "<string>", line 1, in <module>
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
```
Related branches
- Geoff Bache: Pending requested
-
Diff: 15 lines (+5/-0)1 file modifiedcapturemock/pythonclient.py (+5/-0)
- Geoff Bache: Pending requested
-
Diff: 62 lines (+34/-0)5 files modifiedpython_attributes/objects/mutable_mapping/catalogue.cpmock (+4/-0)
python_attributes/objects/mutable_mapping/moduletomock.py (+15/-0)
python_attributes/objects/mutable_mapping/stdout.cpmock (+1/-0)
python_attributes/objects/mutable_mapping/target.py (+11/-0)
python_attributes/objects/testsuite.cpmock (+3/-0)
- Geoff Bache: Pending requested
-
Diff: 90 lines (+45/-0)7 files modifiedpython_attributes/objects/mutable_mapping/replay/capturemock/test.mock (+7/-0)
python_attributes/objects/mutable_mapping/replay/catalogue.cpmock (+1/-0)
python_attributes/objects/mutable_mapping/replay/knownbugs.cpmock (+8/-0)
python_attributes/objects/mutable_mapping/replay/moduletomock.py (+15/-0)
python_attributes/objects/mutable_mapping/replay/stdout.cpmock (+1/-0)
python_attributes/objects/mutable_mapping/replay/target.py (+11/-0)
python_attributes/objects/mutable_mapping/testsuite.cpmock (+2/-0)
Changed in capturemock: | |
status: | Fix Committed → Fix Released |
Added some debug logging for this problem: https:/ /code.launchpad .net/~msabramo/ capturemock/ print_classDefS tr_on_TypeError