From c36b600ad57e54052500aa86e5a8d124ec0b060d Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 27 Jan 2016 13:07:05 -0200 Subject: [PATCH] Test: only publish *_BASEDIR and *_DATADIR env vars when they're set IMHO it makes more sense to only publish these variables when they actually contain meaningful value. Right now it *may* contain "None" as this is maybe the value of the `basedir` and `datadir` attributes when the test is not backed by a file. Also, it's a lot more common, say, for a shell script to check if a variable is set (if [ -n $AVOCADO_TEST_DATA_DIR ] ...) then to check if it's not equal to "None". Signed-off-by: Cleber Rosa --- avocado/core/test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/avocado/core/test.py b/avocado/core/test.py index 378f52d1..d6bf0dcf 100644 --- a/avocado/core/test.py +++ b/avocado/core/test.py @@ -465,8 +465,10 @@ class Test(unittest.TestCase): def _setup_environment_variables(self): os.environ['AVOCADO_VERSION'] = VERSION - os.environ['AVOCADO_TEST_BASEDIR'] = self.basedir - os.environ['AVOCADO_TEST_DATADIR'] = self.datadir + if self.basedir is not None: + os.environ['AVOCADO_TEST_BASEDIR'] = self.basedir + if self.datadir is not None: + os.environ['AVOCADO_TEST_DATADIR'] = self.datadir os.environ['AVOCADO_TEST_WORKDIR'] = self.workdir os.environ['AVOCADO_TEST_SRCDIR'] = self.srcdir os.environ['AVOCADO_TEST_LOGDIR'] = self.logdir -- GitLab