From 1daed8c09a9a379879d2cb7fe22a50fcffbf6af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 2 Oct 2017 13:54:35 +0900
Subject: [PATCH] test_slaposconfiguration: use tempfile.mkdtemp to get a temp
 directory

Test will fail if /tmp/instance_test_resourcefile already exists
---
 slapos/test/recipe/test_slaposconfiguration.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/slapos/test/recipe/test_slaposconfiguration.py b/slapos/test/recipe/test_slaposconfiguration.py
index f57c4821c..9235acd39 100644
--- a/slapos/test/recipe/test_slaposconfiguration.py
+++ b/slapos/test/recipe/test_slaposconfiguration.py
@@ -3,6 +3,7 @@ import json
 import mock
 import os
 import unittest
+import tempfile
 from collections import defaultdict
 from slapos.recipe import slapconfiguration
 from slapos import format as slapformat
@@ -12,8 +13,7 @@ class SlapConfigurationTest(unittest.TestCase):
 
   def setUp(self):
     """Prepare files on filesystem."""
-    self.instance_root = "/tmp/instance_test_resourcefile"
-    os.mkdir(self.instance_root)
+    self.instance_root = tempfile.mkdtemp()
     # create testing resource file
     self.resource_file = os.path.join(self.instance_root, slapformat.Partition.resource_file)
     self.resource = {
-- 
2.30.9