issues with doctest and threads

jepler at unpythonic.net jepler at unpythonic.net
Mon Aug 8 08:10:23 EDT 2005


I don't see the problem with your doctest usage, but what makes you believe that
the code you show below produces exactly 9 dots?

strangely enough, re-working the code to this
>>> import time, threading
>>> def example():
...     thread.out = []
...     for i in range(9): thread.out.append(".")
>>> thread = threading.Thread(None, example)
>>> thread.running = True; thread.start()
>>> time.sleep(.1)
>>> thread.running = False
>>> print thread.out
['.', '.', '.', '.', '.', '.', '.', '.', '.']
makes the test "succeed" (though it can fail for some of the same reasons the
original test isn't guaranteed to give 9 dots either).

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050808/677afc2b/attachment.sig>


More information about the Python-list mailing list