I couldn't find a flexible enough equality comparison between the two
Hooke instances. It doesn't seem worth it to add .__eq__ or .__cmp__
methods to all of my classes just to test Queue-proof-ness. Maybe I'm
just lazy... Anyhow, the original problem case now works:
$echo 'debug' | python bin/hooke
This is Hooke, version 0.9.0.devel (Kenzo)
COPYRIGHT
----
hooke> <hooke.hooke.Hooke object at 0xb6a0bcac>
Success
...
finally:
app.close()
-class TestHooke (unittest.TestCase):
- def test_queue_safe(self):
- """Ensure :class:`Hooke` is :class:`multiprocessing.Queue`-safe.
- """
- from multiprocessing import Queue
- q = Queue()
- a = Hooke()
- q.put(a)
- b = q.get(a)
- for attribute_name in dir(a):
- a_attr = getattr(a, attribute_name)
- b_attr = getattr(b, attribute_name)
- self.failUnless(a_attr == b_attr)
-
if __name__ == '__main__':
main()