From 3e978a46b4c88b2da93bf4a99c0b51cda1bac7c7 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 12 Jun 2015 11:17:43 +0200 Subject: [PATCH] validate:launcher: Avoid printing twice env variables When printing test command. --- validate/launcher/baseclasses.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index e324b697ed..8bef580ab8 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -84,7 +84,7 @@ class Test(Loggable): self.logfile = None self.out = None self.extra_logfiles = [] - self._env_variable = '' + self.__env_variable = [] def __str__(self): string = self.classname @@ -114,9 +114,19 @@ class Test(Loggable): if value is None: return - if self._env_variable: - self._env_variable += " " - self._env_variable += "%s=%s" % (variable, value) + self.__env_variable.append(variable) + + @property + def _env_variable(self): + res = "" + for var in set(self.__env_variable): + if res: + res += " " + value = self.proc_env.get(var, None) + if value: + res += "%s=%s" % (var, value) + + return res def open_logfile(self): path = os.path.join(self.options.logsdir,