Monero
Loading...
Searching...
No Matches
Classes | Functions | Variables
gtest_test_utils Namespace Reference

Classes

class  Subprocess
 

Functions

def SetEnvVar (env_var, value)
 
def _ParseAndStripGTestFlags (argv)
 
def GetFlag (flag)
 
def GetSourceDir ()
 
def GetBuildDir ()
 
def _RemoveTempDir ()
 
def GetTempDir ()
 
def GetTestExecutablePath (executable_name, build_dir=None)
 
def GetExitStatus (exit_code)
 
def Main ()
 

Variables

str __author__ = 'wan@google.com (Zhanyong Wan)'
 
unittest _test_module = unittest
 
 try :
 
bool _SUBPROCESS_MODULE_AVAILABLE = True
 
 except :
 
str GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'
 
os IS_WINDOWS = 'nt'
 
os IS_CYGWIN = 'posix' and 'CYGWIN' in os.uname()[0]
 
str PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'
 
os environ = os.environ.copy()
 
unittest TestCase = _test_module.TestCase
 
dict _flag_map
 
bool _gtest_flags_are_parsed = False
 
None _temp_dir = None
 

Detailed Description

Unit test utilities for Google C++ Testing Framework.

Function Documentation

◆ _ParseAndStripGTestFlags()

def gtest_test_utils._ParseAndStripGTestFlags (   argv)
protected
Parses and strips Google Test flags from argv.  This is idempotent.

◆ _RemoveTempDir()

def gtest_test_utils._RemoveTempDir ( )
protected

◆ GetBuildDir()

def gtest_test_utils.GetBuildDir ( )
Returns the absolute path of the directory where the test binaries are.

◆ GetExitStatus()

def gtest_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).

◆ GetFlag()

def gtest_test_utils.GetFlag (   flag)
Returns the value of the given flag.

◆ GetSourceDir()

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

◆ GetTempDir()

def gtest_test_utils.GetTempDir ( )
Returns a directory for temporary files.

◆ GetTestExecutablePath()

def gtest_test_utils.GetTestExecutablePath (   executable_name,
  build_dir = None 
)
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.
  build_dir:       directory where to look for executables, by default
                   the result of GetBuildDir().

Returns:
  The absolute path of the test binary.

◆ Main()

def gtest_test_utils.Main ( )
Runs the unit test.

◆ SetEnvVar()

def gtest_test_utils.SetEnvVar (   env_var,
  value 
)
Sets/unsets an environment variable to a given value.

Variable Documentation

◆ __author__

str gtest_test_utils.__author__ = 'wan@google.com (Zhanyong Wan)'
private

◆ _flag_map

dict gtest_test_utils._flag_map
protected
Initial value:
1= {'source_dir': os.path.dirname(sys.argv[0]),
2 'build_dir': os.path.dirname(sys.argv[0])}

◆ _gtest_flags_are_parsed

bool gtest_test_utils._gtest_flags_are_parsed = False
protected

◆ _SUBPROCESS_MODULE_AVAILABLE

bool gtest_test_utils._SUBPROCESS_MODULE_AVAILABLE = True
protected

◆ _temp_dir

None gtest_test_utils._temp_dir = None
protected

◆ _test_module

unittest gtest_test_utils._test_module = unittest
protected

◆ environ

os gtest_test_utils.environ = os.environ.copy()

◆ except

gtest_test_utils.except :

◆ GTEST_OUTPUT_VAR_NAME

str gtest_test_utils.GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT'

◆ IS_CYGWIN

os gtest_test_utils.IS_CYGWIN = 'posix' and 'CYGWIN' in os.uname()[0]

◆ IS_WINDOWS

os gtest_test_utils.IS_WINDOWS = 'nt'

◆ PREMATURE_EXIT_FILE_ENV_VAR

str gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE'

◆ TestCase

unittest gtest_test_utils.TestCase = _test_module.TestCase

◆ try

gtest_test_utils.try :