From 707869c22a1a225ee2798c423f5be56ab1f97033 Mon Sep 17 00:00:00 2001 From: Marcus Fuchs Date: Wed, 18 Nov 2020 20:12:05 +0100 Subject: [PATCH] Move default dir_ref and folder creation This needs to happen after setting the library root, not in init. For #393 --- buildingspy/development/regressiontest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/buildingspy/development/regressiontest.py b/buildingspy/development/regressiontest.py index 0debe059..c29411dd 100644 --- a/buildingspy/development/regressiontest.py +++ b/buildingspy/development/regressiontest.py @@ -257,14 +257,7 @@ def __init__( self._rootPackage = os.path.join(self._libHome, 'Resources', 'Scripts', 'Dymola') # Set the reference results directory - if dir_ref is None: - self.dir_ref = os.path.join( - self._libHome, 'Resources', 'ReferenceResults', 'Dymola' - ) - else: - self.dir_ref = dir_ref - if not os.path.exists(self.dir_ref): - os.makedirs(self.dir_ref) + self.dir_ref = dir_ref # Set the tool if tool in ['dymola', 'omc', 'optimica', 'jmodelica']: @@ -437,6 +430,13 @@ def setLibraryRoot(self, rootDir): self._rootPackage = os.path.join(self._libHome, 'Resources', 'Scripts', 'Dymola') self.isValidLibrary(self._libHome) + if self.dir_ref is None: + self.dir_ref = os.path.join( + self._libHome, 'Resources', 'ReferenceResults', 'Dymola' + ) + if not os.path.exists(self.dir_ref): + os.makedirs(self.dir_ref) + def useExistingResults(self, dirs): """ This function allows to use existing results, as opposed to running a simulation.