File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,18 @@ def test_to_url_githubcopilot(self):
5353
5454 def test_unsupported_endpoint (self ):
5555 original_env = os .environ .pop ('AI_API_ENDPOINT' , None )
56- api_endpoint = 'https://unsupported.example.com'
57- os .environ ['AI_API_ENDPOINT' ] = api_endpoint
58-
59- with pytest .raises (ValueError ) as excinfo :
60- list_capi_models ("abc" )
61- msg = str (excinfo .value )
62- assert 'Unsupported Model Endpoint' in msg
63- assert 'https://models.github.ai/inference' in msg
64- assert 'https://api.githubcopilot.com' in msg
65- if original_env :
66- os .environ ['AI_API_ENDPOINT' ] = original_env
56+ try :
57+ api_endpoint = 'https://unsupported.example.com'
58+ os .environ ['AI_API_ENDPOINT' ] = api_endpoint
6759
60+ with pytest .raises (ValueError ) as excinfo :
61+ list_capi_models ("abc" )
62+ msg = str (excinfo .value )
63+ assert 'Unsupported Model Endpoint' in msg
64+ assert 'https://models.github.ai/inference' in msg
65+ assert 'https://api.githubcopilot.com' in msg
66+ finally :
67+ if original_env :
68+ os .environ ['AI_API_ENDPOINT' ] = original_env
6869if __name__ == '__main__' :
6970 pytest .main ([__file__ , '-v' ])
You can’t perform that action at this time.
0 commit comments