import subprocess import os def test_gtest(): me_path = os.path.realpath(__file__) current_dir = os.path.dirname(me_path) my_env = os.environ.copy() my_env['PYTHONPATH'] = current_dir + ":" + os.getenv('PYTHONPATH', "") subprocess.check_call( [os.path.join(current_dir, 'test_gtest_all'), '--gtest_output=xml:' + os.path.join(current_dir, 'gtest_results.xml')], env=my_env )