[Zodb-checkins] CVS: ZODB3/ZEO/tests - ConnectionTests.py:1.39
Tim Peters
tim.one at comcast.net
Mon Jun 16 17:34:05 EDT 2003
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv13650/ZEO/tests
Modified Files:
ConnectionTests.py
Log Message:
CommonSetupTearDown.tearDown(): Ack, this is a mess. Before 2.3, there's
not enough stuff in the Windows Python to wait for spawned servers to shut
down. Spawned servers inherit descriptors for open files from the
spawning process, and because Windows won't let you delete a file that's
still open, the client can't get rid of temp .zec files until the server(s)
disappear(s). There's no good fix for this before 2.3 on Windows. For
now, try deleting the temp files repeatedly, sleeping between failures,
but don't wait forever. If a temp file can't be deleted in the end, raise
the appropriate exception. This should be rare. It's important not to
keep going blindly, as I saw one case earlier today where a test passed
by accident due to picking up a .zec file left behind by a previous test
run.
=== ZODB3/ZEO/tests/ConnectionTests.py 1.38 => 1.39 ===
--- ZODB3/ZEO/tests/ConnectionTests.py:1.38 Mon Jun 16 15:52:39 2003
+++ ZODB3/ZEO/tests/ConnectionTests.py Mon Jun 16 16:34:03 2003
@@ -109,8 +109,24 @@
for c in self.caches:
for i in 0, 1:
path = "c1-%s-%d.zec" % (c, i)
+ # On Windows before 2.3, we don't have a way to wait for
+ # the spawned server(s) to close, and they inherited
+ # file descriptors for our open files. So long as those
+ # processes are alive, we can't delete the files. Try
+ # a few times then give up.
+ need_to_delete = 0
if os.path.exists(path):
- os.unlink(path)
+ need_to_delete = 1
+ for dummy in range(5):
+ try:
+ os.unlink(path)
+ except:
+ time.sleep(0.5)
+ else:
+ need_to_delete = 0
+ break
+ if need_to_delete:
+ os.unlink(path) # sometimes this is just gonna fail
self.__super_tearDown()
def _newAddr(self):
More information about the Zodb-checkins
mailing list