Helper test func for stopping OmniSharp server.

This commit is contained in:
Strahinja Val Markovic 2014-05-08 15:41:07 -07:00
parent a1feadece0
commit 8e40315258
2 changed files with 10 additions and 22 deletions

View File

@ -22,7 +22,7 @@ SetUpPythonPath()
import time import time
import httplib import httplib
from .test_utils import ( Setup, BuildRequest, PathToTestFile, from .test_utils import ( Setup, BuildRequest, PathToTestFile,
ChangeSpecificOptions ) ChangeSpecificOptions, StopOmniSharpServer )
from webtest import TestApp, AppError from webtest import TestApp, AppError
from nose.tools import eq_, with_setup from nose.tools import eq_, with_setup
from hamcrest import ( assert_that, has_item, has_items, has_entry, from hamcrest import ( assert_that, has_item, has_items, has_entry,
@ -89,12 +89,8 @@ def GetCompletions_CsCompleter_Works_test():
results = app.post_json( '/completions', completion_data ).json results = app.post_json( '/completions', completion_data ).json
assert_that( results, has_items( CompletionEntryMatcher( 'CursorLeft' ), assert_that( results, has_items( CompletionEntryMatcher( 'CursorLeft' ),
CompletionEntryMatcher( 'CursorSize' ) ) ) CompletionEntryMatcher( 'CursorSize' ) ) )
StopOmniSharpServer( app )
# We need to turn off the CS server so that it doesn't stick around
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )
@with_setup( Setup ) @with_setup( Setup )
def GetCompletions_CsCompleter_ReloadSolutionWorks_test(): def GetCompletions_CsCompleter_ReloadSolutionWorks_test():
@ -126,11 +122,7 @@ def GetCompletions_CsCompleter_ReloadSolutionWorks_test():
eq_(result, True) eq_(result, True)
# We need to turn off the CS server so that it doesn't stick around StopOmniSharpServer( app )
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )
@with_setup( Setup ) @with_setup( Setup )
def GetCompletions_CsCompleter_StartsWithUnambiguousMultipleSolutions_test(): def GetCompletions_CsCompleter_StartsWithUnambiguousMultipleSolutions_test():
@ -157,11 +149,7 @@ def GetCompletions_CsCompleter_StartsWithUnambiguousMultipleSolutions_test():
break break
time.sleep( 0.2 ) time.sleep( 0.2 )
# We need to turn off the CS server so that it doesn't stick around StopOmniSharpServer( app )
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )
@with_setup( Setup ) @with_setup( Setup )
def GetCompletions_CsCompleter_DoesntStartWithAmbiguousMultipleSolutions_test(): def GetCompletions_CsCompleter_DoesntStartWithAmbiguousMultipleSolutions_test():
@ -195,12 +183,7 @@ def GetCompletions_CsCompleter_DoesntStartWithAmbiguousMultipleSolutions_test():
break break
time.sleep( 0.2 ) time.sleep( 0.2 )
# We need to turn off the CS server so that it doesn't stick around StopOmniSharpServer( app )
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )
raise Exception( ('The Omnisharp server started, despite us not being able ' raise Exception( ('The Omnisharp server started, despite us not being able '
'to find a suitable solution file to feed it. Did you ' 'to find a suitable solution file to feed it. Did you '
'fiddle with the solution finding code in ' 'fiddle with the solution finding code in '

View File

@ -75,3 +75,8 @@ def PathToTestFile( test_basename ):
return os.path.join( PathToTestDataDir(), test_basename ) return os.path.join( PathToTestDataDir(), test_basename )
def StopOmniSharpServer( app ):
app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['StopServer'],
filetype = 'cs' ) )