aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_test_utils.py
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2013-09-06 22:50:25 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2013-09-06 22:50:25 +0000
commitc306ef2e14483dbf4f047a3e1ca3f86111b800ca (patch)
treebe89ba3a0f06a281e3c5e40cb230c5baf0a65a80 /test/gtest_test_utils.py
parent492986a5d05687853174862efc8e70fe31598eba (diff)
downloadgoogletest-c306ef2e14483dbf4f047a3e1ca3f86111b800ca.tar.gz
googletest-c306ef2e14483dbf4f047a3e1ca3f86111b800ca.tar.bz2
googletest-c306ef2e14483dbf4f047a3e1ca3f86111b800ca.zip
supports a protocol for catching tests that prematurely exit
Diffstat (limited to 'test/gtest_test_utils.py')
-rwxr-xr-xtest/gtest_test_utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/gtest_test_utils.py b/test/gtest_test_utils.py
index 6dd8db4b..28884bdc 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.