Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at . Thank you!

Commit 762265fc authored by hm-schuhba1's avatar hm-schuhba1

allow missing output folder.

parent fb5c0ded
Pipeline #76143 failed with stages
in 4 minutes and 10 seconds
......@@ -5,7 +5,7 @@ with open("", "r") as fh:
author="Stefan Schuhbäck",
description="Import VadereProject to ease analysis",
import unittest
import os
import shutil
from vadere_analysis_tool import vadere_project
......@@ -12,7 +14,10 @@ class VadereProjectTests(unittest.TestCase):
self.assertRaises(FileNotFoundError, vadere_project.VadereProject, "testData/s2uSSScre")
def test_no_output_dir(self):
self.assertRaises(FileNotFoundError, vadere_project.VadereProject, "testData/s2ucreInvalid")
shutil.rmtree(os.path.join("testData/s2ucreInvalid", "output"), ignore_errors=True)
self.assertFalse(os.path.exists(os.path.join("testData/s2ucreInvalid", "output")))
p = vadere_project.VadereProject("testData/s2ucreInvalid")
self.assertTrue(os.path.exists(os.path.join("testData/s2ucreInvalid", "output")))
def test_load_output_dir(self):
project = vadere_project.VadereProject("testData/s2ucre")
......@@ -73,11 +73,12 @@ class VadereProject():
self.project_name = str.strip(helper.read_lines(os.path.join(project_dir, 'vadere.project'))[0])
self.output_path = os.path.join(self.project_path, 'output')
if os.path.exists(os.path.join(self.project_path, 'output')):
self.output_path = os.path.join(self.project_path, 'output')
raise FileNotFoundError("Project does not have output folder.")
print("Warn: project {} has no output folder, an empty folder will be created.".format(self.project_name))
os.makedirs(self.output_path, mode=0o755)
if os.path.exists(os.path.join(self.project_path, 'scenarios')):
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