]> 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)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 13 Jun 2018 14:30:55 +0000 (09:30 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 9d820e82ac6bc0f46890df1cdaa104e88cab2a7e)

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

index b1f858138ea615e306bf83916fca94ec653f16b1..fe93d4dbe802025a23979111a26ae30e5c551015 100644 (file)
@@ -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