[pywin32-checkins] pywin32/win32/test test_win32trace.py,1.4,1.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-03-06 23:56:11
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1508 Modified Files: test_win32trace.py Log Message: Allow the test to pass even when another "writer" process is running (so long as it isn't actively writing during the test!) Index: test_win32trace.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32trace.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_win32trace.py 3 May 2004 01:56:29 -0000 1.4 --- test_win32trace.py 6 Mar 2005 23:55:59 -0000 1.5 *************** *** 22,25 **** --- 22,31 ---- class TestInitOps(unittest.TestCase): + def setUp(self): + # clear old data + win32trace.InitRead() + win32trace.read() + win32trace.TermRead() + def tearDown(self): try: *************** *** 59,66 **** # if we both Write and Read are terminated at the same time, ! # we lose the data is that acceptable? win32trace.TermWrite() win32trace.InitRead() ! self.assertEquals('', win32trace.read()) win32trace.TermRead() --- 65,74 ---- # if we both Write and Read are terminated at the same time, ! # we lose the data as the win32 object is closed. Note that ! # if another writer is running, we do *not* lose the data - so ! # test for either the correct data or an empty string win32trace.TermWrite() win32trace.InitRead() ! self.failUnless(win32trace.read() in ['Ta da', '']) win32trace.TermRead() *************** *** 77,80 **** --- 85,92 ---- def setUp(self): win32trace.InitRead() + # If any other writers are running (even if not actively writing), + # terminating the module will *not* close the handle, meaning old data + # will remain. This can cause other tests to fail. + win32trace.read() win32trace.InitWrite() *************** *** 141,144 **** --- 153,157 ---- WriterThread.BucketCount = self.BucketCount win32trace.InitRead() + win32trace.read() # clear any old data. win32trace.InitWrite() CheckNoOtherReaders() *************** *** 189,192 **** --- 202,206 ---- def setUp(self): win32trace.InitRead() + win32trace.read() # clear any old data win32trace.InitWrite() def testHugeChunks(self): |