On Fri, 6 Jul 2007 10:47:16 -0700, Mike Klaas <[EMAIL PROTECTED]> 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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com