]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Fri, 4 May 2018 17:22:52 +0000 (13:22 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
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