Commit 00a73cb0 authored by Jim Fulton's avatar Jim Fulton

Need at atexit handler to clean out layer directories, since the test

runner doesn't call layer teardown when a layer is run as a
subprocess.  This seems insane, ...
parent bc6e4a82
......@@ -18,6 +18,7 @@ $Id$
from ZODB.MappingStorage import DB
import atexit
import os
import tempfile
import time
......@@ -74,12 +75,19 @@ class MininalTestLayer:
self.tmp = tempfile.mkdtemp(self.__name__, dir=os.getcwd())
os.chdir(self.tmp)
# sigh. tearDown isn't called when a layer is run in a sub-process.
atexit.register(clean, self.tmp)
def tearDown(self):
os.chdir(self.here)
zope.testing.setupstack.rmtree(self.tmp)
testSetUp = testTearDown = lambda self: None
def clean(tmp):
if os.path.isdir(tmp):
zope.testing.setupstack.rmtree(tmp)
class AAAA_Test_Runner_Hack(unittest.TestCase):
"""Hack to work around a bug in the test runner.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment