summaryrefslogtreecommitdiff
path: root/test/gtest_test_utils.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-10-12 14:50:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-10-12 14:50:58 +0200
commitac6c52c33a7e288e39e876fe031ee4776b11276a (patch)
treecab71ef4cffc8f17cdba176bbf09ff99559c407d /test/gtest_test_utils.py
parent5f3a8703b307aab697a8fa9045c7135f2c1956c7 (diff)
Google C++ Testing Framework 1.7.0
Diffstat (limited to 'test/gtest_test_utils.py')
-rwxr-xr-xtest/gtest_test_utils.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/gtest_test_utils.py b/test/gtest_test_utils.py
index 4e897bd..28884bd 100755
--- a/test/gtest_test_utils.py
+++ b/test/gtest_test_utils.py
@@ -56,6 +56,21 @@ GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'
IS_WINDOWS = os.name == 'nt'
IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0]
+# The environment variable for specifying the path to the premature-exit file.
+PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'
+
+environ = os.environ.copy()
+
+
+def SetEnvVar(env_var, value):
+ """Sets/unsets an environment variable to a given value."""
+
+ if value is not None:
+ environ[env_var] = value
+ elif env_var in environ:
+ del environ[env_var]
+
+
# Here we expose a class from a particular module, depending on the
# environment. The comment suppresses the 'Invalid variable name' lint
# complaint.
@@ -241,7 +256,7 @@ class Subprocess:
# Changes made by os.environ.clear are not inheritable by child
# processes until Python 2.6. To produce inheritable changes we have
# to delete environment items with the del statement.
- for key in dest:
+ for key in dest.keys():
del dest[key]
dest.update(src)