]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests.conftest allow custom dirs in tmpfile fixture
authorAlfredo Deza <adeza@redhat.com>
Thu, 3 May 2018 18:32:00 +0000 (14:32 -0400)
committerAlfredo Deza <adeza@redhat.com>
Wed, 1 Aug 2018 15:38:30 +0000 (11:38 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 9d820e82ac6bc0f46890df1cdaa104e88cab2a7e)

src/ceph-volume/ceph_volume/tests/conftest.py

index d93fc544651c040770acec49a523a4d273f14773..11e1c1a781e0a13ec7fa048e1f959db6e0b3e3a4 100644 (file)
@@ -140,8 +140,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