From: Stephen Morris Date: Fri, 14 Sep 2012 14:16:56 +0000 (+0100) Subject: [1545] Corrected problems in setting environment variable in tests X-Git-Tag: trac2351_base~70^2~3^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d6f3e1aa02ffc1de9d55a586174022eb60f43887;p=thirdparty%2Fkea.git [1545] Corrected problems in setting environment variable in tests For some reason, the Python "os.putenv()" did not work, so changed to morifying the "os.environ" variable directly. --- diff --git a/src/bin/dhcp4/tests/dhcp4_test.py b/src/bin/dhcp4/tests/dhcp4_test.py index 3ad97c6c98..efe16fb7a9 100644 --- a/src/bin/dhcp4/tests/dhcp4_test.py +++ b/src/bin/dhcp4/tests/dhcp4_test.py @@ -32,11 +32,11 @@ class TestDhcpv4Daemon(unittest.TestCase): # # However, we do want to set the logging lock directory to somewhere # to which we can write - use the current working directory. We then - # set the appropriate environment variable. + # set the appropriate environment variable. os.putenv() doesn't work + # on Ubuntu, so we access os.environ directly. lockdir_envvar = "B10_LOCKFILE_DIR_FROM_BUILD" - lockdir = os.getenv(lockdir_envvar) - if lockdir is None: - os.putenv(lockdir_envvar, os.getcwd()) + if lockdir_envvar not in os.environ: + os.environ[lockdir_envvar] = os.getcwd() def tearDown(self): pass diff --git a/src/bin/dhcp6/tests/dhcp6_test.py b/src/bin/dhcp6/tests/dhcp6_test.py index 0887bbf2a0..78202bd910 100644 --- a/src/bin/dhcp6/tests/dhcp6_test.py +++ b/src/bin/dhcp6/tests/dhcp6_test.py @@ -32,11 +32,11 @@ class TestDhcpv6Daemon(unittest.TestCase): # # However, we do want to set the logging lock directory to somewhere # to which we can write - use the current working directory. We then - # set the appropriate environment variable. + # set the appropriate environment variable. os.putenv() doesn't work + # on Ubuntu, so we access os.environ directly. lockdir_envvar = "B10_LOCKFILE_DIR_FROM_BUILD" - lockdir = os.getenv(lockdir_envvar) - if lockdir is None: - os.putenv(lockdir_envvar, os.getcwd()) + if lockdir_envvar not in os.environ: + os.environ[lockdir_envvar] = os.getcwd() def tearDown(self): pass