From: Alfredo Deza Date: Thu, 3 May 2018 18:32:00 +0000 (-0400) Subject: ceph-volume tests.conftest allow custom dirs in tmpfile fixture X-Git-Tag: v14.0.0~189^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9d820e82ac6bc0f46890df1cdaa104e88cab2a7e;p=ceph-ci.git ceph-volume tests.conftest allow custom dirs in tmpfile fixture Signed-off-by: Alfredo Deza --- 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