Merge lp:~msabramo/capturemock/tests_add_mutable_mapping into lp:~geoff.bache/capturemock/tests

Proposed by Marc Abramowitz
Status: Merged
Merged at revision: 125
Proposed branch: lp:~msabramo/capturemock/tests_add_mutable_mapping
Merge into: lp:~geoff.bache/capturemock/tests
Diff against target: 62 lines (+34/-0)
5 files modified
python_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)
To merge this branch: bzr merge lp:~msabramo/capturemock/tests_add_mutable_mapping
Reviewer Review Type Date Requested Status
Geoff Bache Pending
Review via email: mp+197996@code.launchpad.net

Description of the change

Added a test of capturemock recording with a collections.MutableMapping.

This test currently fails.

To post a comment you must log in.
Revision history for this message
Marc Abramowitz (msabramo) wrote :

This is related to bug 1256218

Revision history for this message
Geoff Bache (geoff.bache) wrote :

Thanks for the test, I've now merged it in. The main change I've made, as I've not been able to fix this yet, is to add a "known bug" in TextTest, telling it that the exception text on standard error implies the presence of the linked bug, so that the test does not disturb others working with the tests and doing other stuff. (I also reordered the tests, I try to keep simple tests near the top and more complex ones near the bottom)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'python_attributes/objects/mutable_mapping'
2=== added file 'python_attributes/objects/mutable_mapping/catalogue.cpmock'
3--- python_attributes/objects/mutable_mapping/catalogue.cpmock 1970-01-01 00:00:00 +0000
4+++ python_attributes/objects/mutable_mapping/catalogue.cpmock 2013-12-06 06:46:25 +0000
5@@ -0,0 +1,4 @@
6+The following new files/directories were created:
7+<Test Directory>
8+----capturemock
9+--------test.mock
10
11=== added file 'python_attributes/objects/mutable_mapping/moduletomock.py'
12--- python_attributes/objects/mutable_mapping/moduletomock.py 1970-01-01 00:00:00 +0000
13+++ python_attributes/objects/mutable_mapping/moduletomock.py 2013-12-06 06:46:25 +0000
14@@ -0,0 +1,15 @@
15+from collections import MutableMapping
16+
17+class MyDict(MutableMapping):
18+ def __init__(self, **kwargs):
19+ self._dict = dict(kwargs)
20+ def __delitem__(self):
21+ del self._dict[key]
22+ def __getitem__(self, key):
23+ return self._dict[key]
24+ def __setitem__(self, key, val):
25+ self._dict[key] = val
26+ def __iter__(self):
27+ return iter(self._dict)
28+ def __len__(self):
29+ return len(self._dict)
30
31=== added file 'python_attributes/objects/mutable_mapping/stderr.cpmock'
32=== added file 'python_attributes/objects/mutable_mapping/stdout.cpmock'
33--- python_attributes/objects/mutable_mapping/stdout.cpmock 1970-01-01 00:00:00 +0000
34+++ python_attributes/objects/mutable_mapping/stdout.cpmock 2013-12-06 06:46:25 +0000
35@@ -0,0 +1,1 @@
36+mutable_mapping["animal"] = 'dog'
37
38=== added file 'python_attributes/objects/mutable_mapping/target.py'
39--- python_attributes/objects/mutable_mapping/target.py 1970-01-01 00:00:00 +0000
40+++ python_attributes/objects/mutable_mapping/target.py 2013-12-06 06:46:25 +0000
41@@ -0,0 +1,11 @@
42+from capturemock import capturemock, RECORD
43+
44+@capturemock('moduletomock', mode=RECORD)
45+def test():
46+ from moduletomock import MyDict
47+
48+ mutable_mapping = MyDict(animal='dog')
49+
50+ print('mutable_mapping["animal"] = %r' % mutable_mapping["animal"])
51+
52+test()
53
54=== modified file 'python_attributes/objects/testsuite.cpmock'
55--- python_attributes/objects/testsuite.cpmock 2013-09-02 20:13:37 +0000
56+++ python_attributes/objects/testsuite.cpmock 2013-12-06 06:46:25 +0000
57@@ -1,3 +1,6 @@
58+# colletions.MutableMapping
59+mutable_mapping
60+
61 # Copy of replay
62 replay
63

Subscribers

People subscribed via source and target branches

to all changes: