From e565212ed5646fc87c3a7c22e75b71afbd27ecf2 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 10 May 2014 10:42:25 -0700 Subject: [PATCH] Use /taskflow/flush-test in the flush function Instead of using /tmp use a taskflow specific directory for the flush testing utility function to make it possible to cleanup any leftover taskflow test directories if/when a test crashes or fails without cleaning itself up. Change-Id: I4d06adf9b9fbf9ec70b511e763edb52a41293e39 --- taskflow/tests/unit/jobs/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taskflow/tests/unit/jobs/base.py b/taskflow/tests/unit/jobs/base.py index addc7edf..6c101e4f 100644 --- a/taskflow/tests/unit/jobs/base.py +++ b/taskflow/tests/unit/jobs/base.py @@ -28,6 +28,8 @@ from taskflow import states from taskflow.utils import misc from taskflow.utils import persistence_utils as p_utils +FLUSH_PATH_TPL = '/taskflow/flush-test/%s' + @contextlib.contextmanager def connect_close(*args): @@ -49,7 +51,7 @@ def flush(client, path=None): # of this context manager will be applied and all watchers will have fired # before this context manager exits. if not path: - path = "/tmp-%s" % uuidutils.generate_uuid() + path = FLUSH_PATH_TPL % uuidutils.generate_uuid() created = threading.Event() deleted = threading.Event() @@ -64,7 +66,7 @@ def flush(client, path=None): return False # cause this watcher to cease to exist watchers.DataWatch(client, path, func=on_created) - client.create(path) + client.create(path, makepath=True) created.wait() try: yield