On Fri, 6 Jul 2007 10:47:16 -0700, Mike Klaas <mike.klaas at gmail.com> wrote: >On 6-Jul-07, at 6:45 AM, Yaakov Nemoy wrote: > >> >> I can do the other three parts, but I am wondering, how do I write a >> deterministic test unit for my patch? How is it done with the >> threading model in python in general? > >I don't know how it is done in general, but for reference, here are >some of the unittests for my read/write lock class: > > [snip] > > read.release() > self.assertEqual(wrlock.readerCount, 0) > time.sleep(.1) > self.assertTrue(writer.gotit) Not exactly deterministic. Instead of a flag attribute, try using an Event or a Condition. Either of these will let you know exactly when the necessary operation has completed. Jean-Paul
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4