Commit 1daed8c0 authored by Jérome Perrin's avatar Jérome Perrin Committed by Rafael Monnerat

test_slaposconfiguration: use tempfile.mkdtemp to get a temp directory

Test will fail if /tmp/instance_test_resourcefile already exists
parent ff15412a
...@@ -3,6 +3,7 @@ import json ...@@ -3,6 +3,7 @@ import json
import mock import mock
import os import os
import unittest import unittest
import tempfile
from collections import defaultdict from collections import defaultdict
from slapos.recipe import slapconfiguration from slapos.recipe import slapconfiguration
from slapos import format as slapformat from slapos import format as slapformat
...@@ -12,8 +13,7 @@ class SlapConfigurationTest(unittest.TestCase): ...@@ -12,8 +13,7 @@ class SlapConfigurationTest(unittest.TestCase):
def setUp(self): def setUp(self):
"""Prepare files on filesystem.""" """Prepare files on filesystem."""
self.instance_root = "/tmp/instance_test_resourcefile" self.instance_root = tempfile.mkdtemp()
os.mkdir(self.instance_root)
# create testing resource file # create testing resource file
self.resource_file = os.path.join(self.instance_root, slapformat.Partition.resource_file) self.resource_file = os.path.join(self.instance_root, slapformat.Partition.resource_file)
self.resource = { self.resource = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment