From 9d820e82ac6bc0f46890df1cdaa104e88cab2a7e Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 3 May 2018 14:32:00 -0400 Subject: [PATCH] ceph-volume tests.conftest allow custom dirs in tmpfile fixture Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/tests/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/tests/conftest.py b/src/ceph-volume/ceph_volume/tests/conftest.py index b1f858138ea..fe93d4dbe80 100644 --- a/src/ceph-volume/ceph_volume/tests/conftest.py +++ b/src/ceph-volume/ceph_volume/tests/conftest.py @@ -132,8 +132,9 @@ def tmpfile(tmpdir): Create a temporary file, optionally filling it with contents, returns an absolute path to the file when called """ - def generate_file(name='file', contents=''): - path = os.path.join(str(tmpdir), name) + def generate_file(name='file', contents='', directory=None): + directory = directory or str(tmpdir) + path = os.path.join(directory, name) with open(path, 'w') as fp: fp.write(contents) return path -- 2.39.5