s4-ldb.python: Use $SELFTEST_PREFIX/tmp as a temporary directory for testing
authorKamen Mazdrashki <kamenim@samba.org>
Thu, 18 Nov 2010 19:42:26 +0000 (21:42 +0200)
committerKamen Mazdrashki <kamenim@samba.org>
Thu, 18 Nov 2010 22:11:18 +0000 (23:11 +0100)
This way we won't flood /tmp directory with temp files

Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Thu Nov 18 23:11:18 CET 2010 on sn-devel-104

source4/lib/ldb/tests/python/api.py

index b5585dcd3df654347fd4c2798a6d6221da6a8d49..31d1319631ad881dde4f3b065aa517204263ecfe 100755 (executable)
@@ -9,7 +9,12 @@ import ldb
 
 
 def filename():
-    return os.tempnam()
+    import tempfile
+    try:
+        dir_prefix = os.path.join(os.environ["SELFTEST_PREFIX"], "tmp")
+    except KeyError:
+        dir_prefix = None
+    return tempfile.mktemp(dir=dir_prefix)
 
 class NoContextTests(unittest.TestCase):