[Kimchi-devel] [PATCH] [Kimchi] Issue #982 - Fix broken testcases.

pvital at linux.vnet.ibm.com pvital at linux.vnet.ibm.com
Wed Aug 17 18:18:34 UTC 2016


From: Paulo Vital <pvital at linux.vnet.ibm.com>

Several testcases started to fail in Fedora 24 after commit 24cc635 added
a solution to create a temporary file to represent the Virt Viewer script
contents in mockmodel.py. The solution is not able to create the directory
in where this temporary file will be created and is failing.

This patch adds a control to make sure the directory exists.

Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
 mockmodel.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mockmodel.py b/mockmodel.py
index 2f55af7..cd06ee3 100644
--- a/mockmodel.py
+++ b/mockmodel.py
@@ -141,8 +141,12 @@ class MockModel(Model):
         cherrypy.engine.subscribe('exit', self.virtviewertmpfile_cleanup)
 
     def _create_virt_viewer_tmp_file(self):
+        path = '../data/virtviewerfiles/'
+        if not os.path.isdir(path):
+            os.makedirs(path)
+
         self.virtviewerfile_tmp = tempfile.NamedTemporaryFile(
-            dir='../data/virtviewerfiles/',
+            dir=path,
             delete=False
         )
         file_content = "[virt-viewer]\ntype=vnc\nhost=127.0.0.1\nport=5999\n"
-- 
2.7.4




More information about the Kimchi-devel mailing list