File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -77,15 +77,9 @@ def __init__(
7777 ) -> None :
7878 self ._client = client
7979 self ._tmp_path = tmp_path
80- self ._daemon_proc : multiprocessing .Process | None = None
8180 self ._session = session
8281 self ._is_xdist = get_xdist_worker_id () is not None
8382
84- def _daemon (self ) -> None :
85- while (self ._tmp_path / "ctrl" ).exists ():
86- time .sleep (0.1 )
87- self ._stop_all_containers ()
88-
8983 def __enter__ (self ) -> Self :
9084 if self ._is_xdist :
9185 ctrl_file = _get_ctrl_file (self ._session )
@@ -134,6 +128,7 @@ def run(
134128 wait_for_log : str | bytes | None = None ,
135129 timeout : int = 10 ,
136130 pause : float = 0.1 ,
131+ transient : bool = False ,
137132 ) -> Generator [ServiceContainer , None , None ]:
138133 if check is None and wait_for_log is None :
139134 msg = "Must set at least check or wait_for_log"
@@ -194,6 +189,9 @@ def run(
194189 container .exec_run (exec_after_start )
195190
196191 yield service
192+ if transient :
193+ container .stop ()
194+ container .remove ()
197195
198196
199197@pytest .fixture (scope = "session" )
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ def check(_service: ServiceContainer) -> bool:
7878 check = check ,
7979 timeout = 120 ,
8080 pause = 1 ,
81+ transient = True ,
8182 ) as service :
8283 yield ElasticsearchService (
8384 host = service .host ,
You can’t perform that action at this time.
0 commit comments