mirror of
https://github.com/google/googletest.git
synced 2025-01-14 00:20:57 +08:00
Makes the Python imports consistently use full paths from the repository root,
unifying the behavior between Bazel and CMake This fixes one of the CI failures on Windows PiperOrigin-RevId: 417872531 Change-Id: I156989323b7e6d4a4420f4f9691b078829db933d
This commit is contained in:
parent
71d4e2f742
commit
c58f562fa2
@ -31,7 +31,7 @@
|
||||
|
||||
"""Tests that leaked mock objects can be caught be Google Mock."""
|
||||
|
||||
import gmock_test_utils
|
||||
from googlemock.test import gmock_test_utils
|
||||
|
||||
PROGRAM_PATH = gmock_test_utils.GetTestExecutablePath('gmock_leak_test_')
|
||||
TEST_WITH_EXPECT_CALL = [PROGRAM_PATH, '--gtest_filter=*ExpectCall*']
|
||||
|
@ -43,7 +43,7 @@ from io import open # pylint: disable=redefined-builtin, g-importing-member
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import gmock_test_utils
|
||||
from googlemock.test import gmock_test_utils
|
||||
|
||||
|
||||
# The flag for generating the golden file
|
||||
|
@ -30,21 +30,9 @@
|
||||
"""Unit test utilities for Google C++ Mocking Framework."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Determines path to gtest_test_utils and imports it.
|
||||
SCRIPT_DIR = os.path.dirname(__file__) or '.'
|
||||
|
||||
# isdir resolves symbolic links.
|
||||
gtest_tests_util_dir = os.path.join(SCRIPT_DIR, '../../googletest/test')
|
||||
if os.path.isdir(gtest_tests_util_dir):
|
||||
GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir
|
||||
else:
|
||||
GTEST_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR, '../../googletest/test')
|
||||
sys.path.append(GTEST_TESTS_UTIL_DIR)
|
||||
|
||||
# pylint: disable=C6204
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
def GetSourceDir():
|
||||
|
@ -304,6 +304,8 @@ function(py_test name)
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
|
||||
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN})
|
||||
endif()
|
||||
# Make the Python import path consistent between Bazel and CMake.
|
||||
set_tests_properties(${name} PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_SOURCE_DIR})
|
||||
endif(PYTHONINTERP_FOUND)
|
||||
endfunction()
|
||||
|
||||
|
@ -39,7 +39,7 @@ Google Test) with different environments and command line flags.
|
||||
"""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
|
||||
|
@ -35,7 +35,7 @@ googletest-catch-exceptions-ex-test_ (programs written with
|
||||
Google Test) and verifies their output.
|
||||
"""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
FLAG_PREFIX = '--gtest_'
|
||||
|
@ -32,7 +32,7 @@
|
||||
"""Verifies that Google Test correctly determines whether to use colors."""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
IS_WINDOWS = os.name == 'nt'
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
"""Verifies that Google Test correctly parses environment variables."""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
IS_WINDOWS = os.name == 'nt'
|
||||
|
@ -41,7 +41,7 @@ line flags.
|
||||
"""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
|
||||
|
@ -47,7 +47,7 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
import sys
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
|
||||
|
@ -36,7 +36,7 @@ googletest-global-environment-unittest_ (a program written with Google Test).
|
||||
"""
|
||||
|
||||
import re
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
def RunAndReturnOutput(args=None):
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import gtest_json_test_utils
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_json_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
GTEST_OUTPUT_SUBDIR = 'json_outfiles'
|
||||
GTEST_OUTPUT_1_TEST = 'gtest_xml_outfile1_test_'
|
||||
|
@ -37,8 +37,8 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import gtest_json_test_utils
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_json_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
GTEST_FILTER_FLAG = '--gtest_filter'
|
||||
GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
|
||||
|
@ -38,7 +38,7 @@ Google Test) the command line flags.
|
||||
"""
|
||||
|
||||
import re
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Constants.
|
||||
|
||||
|
@ -42,7 +42,7 @@ import difflib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
# The flag for generating the golden file
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
"""Verifies that Google Test warns the user when not initialized properly."""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
binary_name = 'googletest-param-test-invalid-name1-test_'
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
"""Verifies that Google Test warns the user when not initialized properly."""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
binary_name = 'googletest-param-test-invalid-name2-test_'
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
"""Verifies that SetUpTestSuite and TearDownTestSuite errors are noticed."""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath(
|
||||
'googletest-setuptestsuite-test_')
|
||||
|
@ -31,7 +31,7 @@
|
||||
"""Verifies that test shuffling works."""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Command to run the googletest-shuffle-test_ program.
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-shuffle-test_')
|
||||
|
@ -36,7 +36,7 @@ Google Test) with different environments and command line flags.
|
||||
"""
|
||||
|
||||
import os
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
# Constants.
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
"""Verifies that Google Test warns the user when not initialized properly."""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-uninitialized-test_')
|
||||
|
||||
|
@ -39,7 +39,7 @@ SYNOPSIS
|
||||
|
||||
import os
|
||||
import re
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
|
||||
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
|
||||
|
@ -40,7 +40,7 @@ This script tests such functionality by invoking gtest_list_output_unittest_
|
||||
|
||||
import os
|
||||
import re
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
|
||||
GTEST_OUTPUT_FLAG = '--gtest_output'
|
||||
|
@ -35,7 +35,7 @@ output.
|
||||
|
||||
import re
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Path to the gtest_skip_in_environment_setup_test binary
|
||||
EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_skip_test')
|
||||
|
@ -33,7 +33,7 @@ This script invokes gtest_skip_in_environment_setup_test_ and verifies its
|
||||
output.
|
||||
"""
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
# Path to the gtest_skip_in_environment_setup_test binary
|
||||
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
import os
|
||||
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
binary_name = 'gtest_testbridge_test_'
|
||||
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
|
||||
|
@ -33,8 +33,8 @@
|
||||
|
||||
import os
|
||||
from xml.dom import minidom, Node
|
||||
import gtest_test_utils
|
||||
import gtest_xml_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
from googletest.test import gtest_xml_test_utils
|
||||
|
||||
GTEST_OUTPUT_SUBDIR = "xml_outfiles"
|
||||
GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_"
|
||||
|
@ -38,8 +38,8 @@ import re
|
||||
import sys
|
||||
from xml.dom import minidom, Node
|
||||
|
||||
import gtest_test_utils
|
||||
import gtest_xml_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
from googletest.test import gtest_xml_test_utils
|
||||
|
||||
GTEST_FILTER_FLAG = '--gtest_filter'
|
||||
GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
import re
|
||||
from xml.dom import minidom, Node
|
||||
import gtest_test_utils
|
||||
from googletest.test import gtest_test_utils
|
||||
|
||||
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user