+ # We need at least a path to a recipe file or a dir to a test
+ if not dir and not recipe:
+ raise TestException("Did not get a path to a test or to a recipe file")
+
+ # We cannot decide which to use when we get both
+ if (dir and recipe_file) or (dir and settings_file):
+ raise TestException("Get dir and path to recipe or settings file")
+
+ if dir:
+ try:
+ if not os.path.isabs(dir):
+ self.path = os.path.abspath(dir)
+ except BaseException as e:
+ logger.error("Could not get absolute path")
+ raise e
+
+ logger.debug("Path of this test is: {}".format(self.path))
+
+ self.recipe_file = "{}/recipe".format(self.path)
+ self.settings_file = "{}/settings".format(self.path)
+
+ if recipe_file:
+ if not os.path.isabs(recipe_file):
+ self.recipe_file = os.path.abspath(recipe_file)
+ else:
+ self.recipe_file = recipe_file
+
+ if settings_file:
+ if not os.path.isabs(settings_file):
+ self.settings_file = os.path.abspath(settings_file)
+ else:
+ self.settings_file = settings_file