def load_tests(loader: unittest.TestLoader, standard_tests, pattern): if not ImportCore().HasClangSupport(): return unittest.TestSuite() this_dir = os.path.dirname(__file__) package_tests = loader.discover(this_dir, pattern) standard_tests.addTests(package_tests) return standard_tests
import tempfile import time import stat import shutil import json from ycmd import extra_conf_store, handlers, user_options_store from ycmd.completers.completer import Completer from ycmd.responses import BuildCompletionData from ycmd.utils import ( GetCurrentDirectory, ImportCore, OnMac, OnWindows, ToUnicode, WaitUntilProcessIsTerminated ) ycm_core = ImportCore() from unittest import skipIf TESTS_DIR = os.path.abspath( os.path.dirname( __file__ ) ) TEST_OPTIONS = { # The 'client' represented by the tests supports on-demand resolve, but the # server default config doesn't for backward compatibility 'max_num_candidates_to_detail': 10 } WindowsOnly = skipIf( not OnWindows(), 'Windows only' ) ClangOnly = skipIf( not ycm_core.HasClangSupport(), 'Only when Clang support available' ) MacOnly = skipIf( not OnMac(), 'Mac only' ) UnixOnly = skipIf( OnWindows(), 'Unix only' )
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with ycmd. If not, see <http://www.gnu.org/licenses/>. from ycmd.completers.cpp.clang_completer import ConvertCompletionData from ycmd.responses import BuildDiagnosticData from ycmd.tests.bindings import PathToTestFile from ycmd.tests.test_utils import (ClangOnly, TemporaryTestDir, TemporaryClangProject) from ycmd.utils import ImportCore from hamcrest import (assert_that, contains_exactly, contains_inanyorder, contains_string, equal_to, has_entries, has_properties) ycm_core = ImportCore() import os def CppBindings_FilterAndSortCandidates_test(): candidates = ['foo1', 'foo2', 'foo3'] query = 'oo' candidate_property = '' result_full = ycm_core.FilterAndSortCandidates(candidates, candidate_property, query) result_2 = ycm_core.FilterAndSortCandidates(candidates, candidate_property, query, 2) del candidates del query