You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Python scripts need a lot of set-up and tear-down code to
pass environment variables to child processes. When Hady's patch
(http://codereview.appspot.com/153042/show) is done, we can add a
parameter called update_env to gtest_test_utils.Subprocess that will let
users modify the environment being passed to Subprocess. With this
parameter, we can do away with all the SetEnvVar calls and many finally
sections in the Python tests. We will simply set update_env to set or clear
the desired env var.
An approximate code for achieving this:
def __init__(self, command, working_dir=None, capture_stderr=True,
env=None, update_env=None):
if update_env:
if env:
env = env.copy()
else:
env = os.environ.copy()
# Modifies env with values from update_env.
# None values in update_env cause deletion
# of keys in env.
for key in update_env.keys():
if update_env[key] is None and key in env:
del env[key]
else:
env[key] = update_env[key]
Original issue reported on code.google.com by vladlosev on 16 Nov 2009 at 1:55
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
vladlosev
on 16 Nov 2009 at 1:55The text was updated successfully, but these errors were encountered: