tesseract v5.3.3.20231005
gmock_test_utils Namespace Reference

Functions

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

Variables

string SCRIPT_DIR = os.path.dirname(__file__) or '.'
 
 gtest_tests_util_dir = os.path.join(SCRIPT_DIR, '../../googletest/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

◆ GetExitStatus()

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 72 of file gmock_test_utils.py.

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

◆ GetSourceDir()

def gmock_test_utils.GetSourceDir ( )
Returns the absolute path of the directory where the .py files are.

Definition at line 50 of file gmock_test_utils.py.

50def GetSourceDir():
51 """Returns the absolute path of the directory where the .py files are."""
52
54
55

◆ GetTestExecutablePath()

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 56 of file gmock_test_utils.py.

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

◆ Main()

def gmock_test_utils.Main ( )
Runs the unit test.

Definition at line 105 of file gmock_test_utils.py.

105def Main():
106 """Runs the unit test."""
107

Variable Documentation

◆ environ

gmock_test_utils.environ = gtest_test_utils.environ

Definition at line 98 of file gmock_test_utils.py.

◆ gtest_tests_util_dir

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

Definition at line 39 of file gmock_test_utils.py.

◆ GTEST_TESTS_UTIL_DIR

gmock_test_utils.GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir

Definition at line 41 of file gmock_test_utils.py.

◆ PREMATURE_EXIT_FILE_ENV_VAR

gmock_test_utils.PREMATURE_EXIT_FILE_ENV_VAR = gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR

Definition at line 100 of file gmock_test_utils.py.

◆ SCRIPT_DIR

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

Definition at line 36 of file gmock_test_utils.py.

◆ SetEnvVar

gmock_test_utils.SetEnvVar = gtest_test_utils.SetEnvVar

Definition at line 99 of file gmock_test_utils.py.

◆ Subprocess

gmock_test_utils.Subprocess = gtest_test_utils.Subprocess

Definition at line 96 of file gmock_test_utils.py.

◆ TestCase

gmock_test_utils.TestCase = gtest_test_utils.TestCase

Definition at line 97 of file gmock_test_utils.py.