1010import subprocess
1111import time
1212import urllib .parse
13+ import warnings
1314from typing import Any , Dict , List , Optional , Set
1415
1516import psutil
@@ -201,8 +202,9 @@ def __del__(self) -> None:
201202 ensures that the `close` method is called to release any resources
202203 or perform any necessary cleanup.
203204 """
204-
205- self .close ()
205+ if self ._server_is_alive ():
206+ warnings .warn ("unclosed server" , ResourceWarning , stacklevel = 2 )
207+ self .close ()
206208
207209 def __repr__ (self ) -> str :
208210 """
@@ -605,7 +607,7 @@ def _start_local_server(self) -> None:
605607 def _wait_for_server_ready (self , timeout : int = 15 ) -> None :
606608 """
607609 Wait for the LanguageTool server to become ready and responsive.
608- This method polls the server's ``/languages `` endpoint until it responds
610+ This method polls the server's ``/healthcheck `` endpoint until it responds
609611 successfully or until the timeout is reached. It also monitors the server
610612 process to detect early exits.
611613
@@ -616,7 +618,7 @@ def _wait_for_server_ready(self, timeout: int = 15) -> None:
616618 or if the server does not become ready within the specified
617619 timeout period.
618620 """
619- url = urllib .parse .urljoin (self ._url , "languages " )
621+ url = urllib .parse .urljoin (self ._url , "healthcheck " )
620622 start = time .time ()
621623
622624 while time .time () - start < timeout :
0 commit comments