Index: ext/googletest/googletest/test/gtest_test_utils.py =================================================================== diff -u -r4a481bbe77043e0bda2435c6d62a02700b3e46c5 -r2e4eacb299f21d06196fe13140b4b0d095abdca9 --- ext/googletest/googletest/test/gtest_test_utils.py (.../gtest_test_utils.py) (revision 4a481bbe77043e0bda2435c6d62a02700b3e46c5) +++ ext/googletest/googletest/test/gtest_test_utils.py (.../gtest_test_utils.py) (revision 2e4eacb299f21d06196fe13140b4b0d095abdca9) @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# # Copyright 2006, Google Inc. # All rights reserved. # @@ -29,20 +27,21 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -"""Unit test utilities for Google C++ Testing Framework.""" +"""Unit test utilities for Google C++ Testing and Mocking Framework.""" +# Suppresses the 'Import not at the top of the file' lint complaint. +# pylint: disable-msg=C6204 -__author__ = 'wan@google.com (Zhanyong Wan)' +import os +import sys +IS_WINDOWS = os.name == 'nt' +IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0] + import atexit -import os import shutil -import sys import tempfile -import unittest -_test_module = unittest +import unittest as _test_module -# Suppresses the 'Import not at the top of the file' lint complaint. -# pylint: disable-msg=C6204 try: import subprocess _SUBPROCESS_MODULE_AVAILABLE = True @@ -53,9 +52,6 @@ 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' @@ -74,7 +70,7 @@ # Here we expose a class from a particular module, depending on the # environment. The comment suppresses the 'Invalid variable name' lint # complaint. -TestCase = _test_module.TestCase # pylint: disable-msg=C6409 +TestCase = _test_module.TestCase # pylint: disable=C6409 # Initially maps a flag to its default value. After # _ParseAndStripGTestFlags() is called, maps a flag to its actual value. @@ -88,7 +84,7 @@ # Suppresses the lint complaint about a global variable since we need it # here to maintain module-wide state. - global _gtest_flags_are_parsed # pylint: disable-msg=W0603 + global _gtest_flags_are_parsed # pylint: disable=W0603 if _gtest_flags_are_parsed: return @@ -145,8 +141,6 @@ def GetTempDir(): - """Returns a directory for temporary files.""" - global _temp_dir if not _temp_dir: _temp_dir = tempfile.mkdtemp() @@ -178,7 +172,7 @@ 'Unable to find the test binary "%s". Please make sure to provide\n' 'a path to the binary via the --build_dir flag or the BUILD_DIR\n' 'environment variable.' % path) - sys.stdout.write(message) + print >> sys.stderr, message sys.exit(1) return path @@ -245,7 +239,7 @@ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=stderr, cwd=working_dir, universal_newlines=True, env=env) - # communicate returns a tuple with the file obect for the child's + # communicate returns a tuple with the file object for the child's # output. self.output = p.communicate()[0] self._return_code = p.returncode @@ -312,7 +306,7 @@ _ParseAndStripGTestFlags(sys.argv) # The tested binaries should not be writing XML output files unless the # script explicitly instructs them to. - # TODO(vladl@google.com): Move this into Subprocess when we implement + # FIXME: Move this into Subprocess when we implement # passing environment into it as a parameter. if GTEST_OUTPUT_VAR_NAME in os.environ: del os.environ[GTEST_OUTPUT_VAR_NAME]