Making the cs_completer test less flaky

This commit is contained in:
Strahinja Val Markovic 2013-10-09 13:17:53 -07:00
parent aac33b61e9
commit 70a51be209
2 changed files with 16 additions and 4 deletions

View File

@ -72,6 +72,7 @@ class CsharpCompleter( Completer ):
return [ 'StartServer',
'StopServer',
'RestartServer',
'ServerRunning',
'GoToDefinition',
'GoToDeclaration',
'GoToDefinitionElseDeclaration' ]
@ -96,6 +97,8 @@ class CsharpCompleter( Completer ):
if self._ServerIsRunning():
self._StopServer()
self._StartServer( request_data )
elif command == 'ServerRunning':
return self._ServerIsRunning()
elif command in [ 'GoToDefinition',
'GoToDeclaration',
'GoToDefinitionElseDeclaration' ]:
@ -198,8 +201,11 @@ class CsharpCompleter( Completer ):
def _ServerIsRunning( self ):
""" Check if our OmniSharp server is running """
return ( self._omnisharp_port != None and
self._GetResponse( '/checkalivestatus', silent = True ) != None )
try:
return bool( self._omnisharp_port and
self._GetResponse( '/checkalivestatus', silent = True ) )
except:
return False
def _ServerLocation( self ):

View File

@ -115,8 +115,14 @@ def GetCompletions_CsCompleter_Works_test():
app.post_json( '/event_notification', event_data )
# We need to wait until the server has started up.
# TODO: This is a HORRIBLE hack. Fix it!
time.sleep( 2 )
while True:
result = app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['ServerRunning'],
filetype = 'cs' ) ).json
if result:
break
time.sleep( 0.2 )
completion_data = BuildRequest( filepath = filepath,
filetype = 'cs',