diff options
| author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-07-01 04:58:05 +0000 | 
|---|---|---|
| committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-07-01 04:58:05 +0000 | 
| commit | b2db677c9905a34ca6454aa526f7a0cc5cfaeca1 (patch) | |
| tree | 673f967d6404ea730ccb3d93f30cd3bff5fc8a0e /test/gtest_test_utils.py | |
| parent | 1b61f16aef4ea5bb2a7b28e759996dab10e0ca72 (diff) | |
| download | googletest-b2db677c9905a34ca6454aa526f7a0cc5cfaeca1.tar.gz googletest-b2db677c9905a34ca6454aa526f7a0cc5cfaeca1.tar.bz2 googletest-b2db677c9905a34ca6454aa526f7a0cc5cfaeca1.zip  | |
Reduces the flakiness of gtest-port_test on Mac; improves the Python tests; hides methods that we don't want to publish; makes win-dbg8 the default scons configuration (all by Vlad Losev).
Diffstat (limited to 'test/gtest_test_utils.py')
| -rwxr-xr-x | test/gtest_test_utils.py | 20 | 
1 files changed, 15 insertions, 5 deletions
diff --git a/test/gtest_test_utils.py b/test/gtest_test_utils.py index 5b28fe49..385662ad 100755 --- a/test/gtest_test_utils.py +++ b/test/gtest_test_utils.py @@ -190,7 +190,7 @@ def GetExitStatus(exit_code):  class Subprocess: -  def __init__(self, command, working_dir=None): +  def __init__(self, command, working_dir=None, capture_stderr=True):      """Changes into a specified directory, if provided, and executes a command.      Restores the old directory afterwards. Execution results are returned      via the following attributes: @@ -203,8 +203,10 @@ class Subprocess:                               combined in a string.      Args: -      command: A command to run, in the form of sys.argv. -      working_dir: A directory to change into. +      command:        The command to run, in the form of sys.argv. +      working_dir:    The directory to change into. +      capture_stderr: Determines whether to capture stderr in the output member +                      or to discard it.      """      # The subprocess module is the preferrable way of running programs @@ -215,8 +217,13 @@ class Subprocess:      # functionality (Popen4) under Windows. This allows us to support Mac      # OS X 10.4 Tiger, which has python 2.3 installed.      if _SUBPROCESS_MODULE_AVAILABLE: +      if capture_stderr: +        stderr = subprocess.STDOUT +      else: +        stderr = subprocess.PIPE +        p = subprocess.Popen(command, -                           stdout=subprocess.PIPE, stderr=subprocess.STDOUT, +                           stdout=subprocess.PIPE, stderr=stderr,                             cwd=working_dir, universal_newlines=True)        # communicate returns a tuple with the file obect for the child's        # output. @@ -227,7 +234,10 @@ class Subprocess:        try:          if working_dir is not None:            os.chdir(working_dir) -        p = popen2.Popen4(command) +        if capture_stderr: +          p = popen2.Popen4(command) +        else: +          p = popen2.Popen3(command)          p.tochild.close()          self.output = p.fromchild.read()          ret_code = p.wait()  | 
