MCPcopy Create free account
hub / github.com/ycm-core/YouCompleteMe / YouCompleteMeInstance

Function YouCompleteMeInstance

python/ycm/tests/__init__.py:106–134  ·  view source on GitHub ↗

Defines a decorator function for tests that passes a unique YouCompleteMe instance as a parameter. This instance is initialized with the default options `DEFAULT_CLIENT_OPTIONS`. Use the optional parameter |custom_options| to give additional options and/or override the already existing ones.

( custom_options = {} )

Source from the content-addressed store, hash-verified

104
105
106def YouCompleteMeInstance( custom_options = {} ):
107 """Defines a decorator function for tests that passes a unique YouCompleteMe
108 instance as a parameter. This instance is initialized with the default options
109 `DEFAULT_CLIENT_OPTIONS`. Use the optional parameter |custom_options| to give
110 additional options and/or override the already existing ones.
111
112 Example usage:
113
114 from ycm.tests import YouCompleteMeInstance
115
116 @YouCompleteMeInstance( { 'log_level': 'debug',
117 'keep_logfiles': 1 } )
118 def Debug_test( ycm ):
119 ...
120 """
121 def Decorator( test ):
122 @functools.wraps( test )
123 def Wrapper( test_case_instance, *args, **kwargs ):
124 with UserOptions( custom_options ):
125 ycm = YouCompleteMe()
126 WaitUntilReady()
127 ycm.CheckIfServerIsReady()
128 try:
129 test_utils.VIM_PROPS_FOR_BUFFER.clear()
130 return test( test_case_instance, ycm, *args, **kwargs )
131 finally:
132 StopServer( ycm )
133 return Wrapper
134 return Decorator
135
136
137@contextlib.contextmanager

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected