proxygen
gmock_test_utils Namespace Reference

Functions

def GetSourceDir ()
 
def GetTestExecutablePath (executable_name)
 
def GetExitStatus (exit_code)
 
def Main ()
 

Variables

string __author__ = 'wan@google.com (Zhanyong Wan)'
 
string SCRIPT_DIR = os.path.dirname(__file__)or'.'
 
 gtest_tests_util_dir = os.path.join(SCRIPT_DIR, '../gtest/test')
 
 GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir
 
 Subprocess = gtest_test_utils.Subprocess
 
 TestCase = gtest_test_utils.TestCase
 
 environ = gtest_test_utils.environ
 
 SetEnvVar = gtest_test_utils.SetEnvVar
 
 PREMATURE_EXIT_FILE_ENV_VAR = gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR
 

Function Documentation

def gmock_test_utils.GetExitStatus (   exit_code)
Returns the argument to exit(), or -1 if exit() wasn't called.

Args:
  exit_code: the result value of os.system(command).

Definition at line 76 of file gmock_test_utils.py.

76 def GetExitStatus(exit_code):
77  """Returns the argument to exit(), or -1 if exit() wasn't called.
78 
79  Args:
80  exit_code: the result value of os.system(command).
81  """
82 
83  if os.name == 'nt':
84  # On Windows, os.WEXITSTATUS() doesn't work and os.system() returns
85  # the argument to exit() directly.
86  return exit_code
87  else:
88  # On Unix, os.WEXITSTATUS() must be used to extract the exit status
89  # from the result of os.system().
90  if os.WIFEXITED(exit_code):
91  return os.WEXITSTATUS(exit_code)
92  else:
93  return -1
94 
95 
96 # Suppresses the "Invalid const name" lint complaint
97 # pylint: disable-msg=C6409
98 
99 # Exposes utilities from gtest_test_utils.
def GetExitStatus(exit_code)
def gmock_test_utils.GetSourceDir ( )
Returns the absolute path of the directory where the .py files are.

Definition at line 54 of file gmock_test_utils.py.

References gtest_test_utils.GetSourceDir().

55  """Returns the absolute path of the directory where the .py files are."""
56 
58 
59 
def gmock_test_utils.GetTestExecutablePath (   executable_name)
Returns the absolute path of the test binary given its name.

The function will print a message and abort the program if the resulting file
doesn't exist.

Args:
  executable_name: name of the test binary that the test script runs.

Returns:
  The absolute path of the test binary.

Definition at line 60 of file gmock_test_utils.py.

References gtest_test_utils.GetTestExecutablePath().

60 def GetTestExecutablePath(executable_name):
61  """Returns the absolute path of the test binary given its name.
62 
63  The function will print a message and abort the program if the resulting file
64  doesn't exist.
65 
66  Args:
67  executable_name: name of the test binary that the test script runs.
68 
69  Returns:
70  The absolute path of the test binary.
71  """
72 
73  return gtest_test_utils.GetTestExecutablePath(executable_name)
74 
75 
def GetTestExecutablePath(executable_name, build_dir=None)
def GetTestExecutablePath(executable_name)
def gmock_test_utils.Main ( )
Runs the unit test.

Definition at line 109 of file gmock_test_utils.py.

References gtest_test_utils.Main().

Referenced by gmock_leak_test.GMockLeakTest.testCatchesMultipleLeakedMocks(), and gmock_output_test.GMockOutputTest.testOutput().

109 def Main():
110  """Runs the unit test."""
111 

Variable Documentation

string gmock_test_utils.__author__ = 'wan@google.com (Zhanyong Wan)'
private

Definition at line 34 of file gmock_test_utils.py.

gmock_test_utils.environ = gtest_test_utils.environ

Definition at line 102 of file gmock_test_utils.py.

gmock_test_utils.gtest_tests_util_dir = os.path.join(SCRIPT_DIR, '../gtest/test')

Definition at line 44 of file gmock_test_utils.py.

gmock_test_utils.GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir

Definition at line 46 of file gmock_test_utils.py.

gmock_test_utils.PREMATURE_EXIT_FILE_ENV_VAR = gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR

Definition at line 104 of file gmock_test_utils.py.

string gmock_test_utils.SCRIPT_DIR = os.path.dirname(__file__)or'.'

Definition at line 41 of file gmock_test_utils.py.

gmock_test_utils.SetEnvVar = gtest_test_utils.SetEnvVar

Definition at line 103 of file gmock_test_utils.py.