1414from pylsp .python_lsp import start_io_lang_server , PythonLSPServer
1515
1616CALL_TIMEOUT = 10
17- PY2 = sys .version_info [0 ] == 2
18- PY3 = sys .version_info [0 ] == 3
17+ RUNNING_IN_CI = bool (os .environ .get ('CI' ))
1918
2019
2120def start_client (client ):
@@ -87,8 +86,7 @@ def test_initialize(client_server): # pylint: disable=redefined-outer-name
8786
8887
8988@flaky (max_runs = 10 , min_passes = 1 )
90- @pytest .mark .skipif (os .name == 'nt' or (sys .platform .startswith ('linux' ) and PY3 ),
91- reason = 'Skipped on win and fails on linux >=3.6' )
89+ @pytest .mark .skipif (not sys .platform .startswith ('Linux' ), reason = 'Skipped on win and flaky on mac' )
9290def test_exit_with_parent_process_died (client_exited_server ): # pylint: disable=redefined-outer-name
9391 # language server should have already exited before responding
9492 lsp_server , mock_process = client_exited_server .client , client_exited_server .process
@@ -104,8 +102,7 @@ def test_exit_with_parent_process_died(client_exited_server): # pylint: disable
104102 assert not client_exited_server .client_thread .is_alive ()
105103
106104
107- @pytest .mark .skipif (sys .platform .startswith ('linux' ) and PY3 ,
108- reason = 'Fails on linux and py3' )
105+ @pytest .mark .skipif (sys .platform .startswith ('linux' ), reason = 'Fails on linux' )
109106def test_not_exit_without_check_parent_process_flag (client_server ): # pylint: disable=redefined-outer-name
110107 response = client_server ._endpoint .request ('initialize' , {
111108 'processId' : 1234 ,
@@ -115,7 +112,7 @@ def test_not_exit_without_check_parent_process_flag(client_server): # pylint: d
115112 assert 'capabilities' in response
116113
117114
118- @pytest .mark .skipif (bool ( os . environ . get ( 'CI' )) , reason = 'This test is hanging on CI' )
115+ @pytest .mark .skipif (RUNNING_IN_CI , reason = 'This test is hanging on CI' )
119116def test_missing_message (client_server ): # pylint: disable=redefined-outer-name
120117 with pytest .raises (JsonRpcMethodNotFound ):
121118 client_server ._endpoint .request ('unknown_method' ).result (timeout = CALL_TIMEOUT )
0 commit comments