To make it easier to see the problem without TextTest, here's a command-line demonstration. Once there is a recorded mock and you try to replay it, then the error appears:
```
marca@marca-mac2:~/dev/bzr-repos/capturemock$ cat test_mutable_mapping.py
from capturemock import capturemock
@capturemock('moduletomock')
def test():
from moduletomock import MyDict
test()
marca@marca-mac2:~/dev/bzr-repos/capturemock$ python test_mutable_mapping.py
mutable_mapping["animal"] = 'dog'
marca@marca-mac2:~/dev/bzr-repos/capturemock$ CAPTUREMOCK_MODE=1 python test_mutable_mapping.py
mutable_mapping["animal"] = 'dog'
marca@marca-mac2:~/dev/bzr-repos/capturemock$ python test_mutable_mapping.py
*** TypeError while trying to exec classDefStr = 'class MyDict(InstanceProxy, _abcoll.MutableMapping) : __metaclass__ = ProxyMetaClass'
Traceback (most recent call last):
File "test_mutable_mapping.py", line 11, in <module>
test()
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/__init__.py", line 210, in wrapped_func
result = func(*funcargs, **funckw)
File "test_mutable_mapping.py", line 5, in test
from moduletomock import MyDict
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 103, in __getattr__
self.captureMockTarget)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythontraffic.py", line 535, in getAttribute
return self.getAttributeFromReplay(traffic, proxyTarget, attrName, proxy, fullAttrName)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythontraffic.py", line 552, in getAttributeFromReplay
return proxy.captureMockCreateClassProxy(fullAttrName, newTarget, classDesc)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 125, in captureMockCreateClassProxy
classProxy = self.captureMockMakeClass(classDesc, proxyTarget)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 122, in captureMockMakeClass
return self.captureMockNameFinder.makeClass(classDesc, metaClassName)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 48, in makeClass
return self.defineClass(actualClassName, classDefStr)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 17, in defineClass
self.defineClassLocally(classDefStr)
File "/Users/marca/dev/bzr-repos/capturemock/capturemock/pythonclient.py", line 61, in defineClassLocally
exec(classDefStr, self)
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
```
To make it easier to see the problem without TextTest, here's a command-line demonstration. Once there is a recorded mock and you try to replay it, then the error appears:
``` mac2:~/ dev/bzr- repos/capturemo ck$ cat test_mutable_ mapping. py
marca@marca-
from capturemock import capturemock
@capturemock( 'moduletomock' )
def test():
from moduletomock import MyDict
mutable_mapping = MyDict( animal= 'dog')
print( 'mutable_ mapping[ "animal" ] = %r' % mutable_ mapping[ "animal" ])
test() mac2:~/ dev/bzr- repos/capturemo ck$ python test_mutable_ mapping. py mapping[ "animal" ] = 'dog' mac2:~/ dev/bzr- repos/capturemo ck$ CAPTUREMOCK_MODE=1 python test_mutable_ mapping. py mapping[ "animal" ] = 'dog' mac2:~/ dev/bzr- repos/capturemo ck$ python test_mutable_ mapping. py InstanceProxy, _abcoll. MutableMapping) : __metaclass__ = ProxyMetaClass' mapping. py", line 11, in <module> marca/dev/ bzr-repos/ capturemock/ capturemock/ __init_ _.py", line 210, in wrapped_func mapping. py", line 5, in test marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 103, in __getattr__ captureMockTarg et) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythontraffic. py", line 535, in getAttribute teFromReplay( traffic, proxyTarget, attrName, proxy, fullAttrName) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythontraffic. py", line 552, in getAttributeFro mReplay ckCreateClassPr oxy(fullAttrNam e, newTarget, classDesc) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 125, in captureMockCrea teClassProxy kMakeClass( classDesc, proxyTarget) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 122, in captureMockMake Class kNameFinder. makeClass( classDesc, metaClassName) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 48, in makeClass s(actualClassNa me, classDefStr) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 17, in defineClass defineClassLoca lly(classDefStr ) marca/dev/ bzr-repos/ capturemock/ capturemock/ pythonclient. py", line 61, in defineClassLocally classDefStr, self)
marca@marca-
mutable_
marca@marca-
mutable_
marca@marca-
*** TypeError while trying to exec classDefStr = 'class MyDict(
Traceback (most recent call last):
File "test_mutable_
test()
File "/Users/
result = func(*funcargs, **funckw)
File "test_mutable_
from moduletomock import MyDict
File "/Users/
self.
File "/Users/
return self.getAttribu
File "/Users/
return proxy.captureMo
File "/Users/
classProxy = self.captureMoc
File "/Users/
return 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
```