@@ -103,13 +103,15 @@ def lambda_runtime_url(request, lambda_zip): # noqa: ARG001
103103 check = lambda : is_responsive (base_url ),
104104 )
105105
106- return base_url
107-
106+ yield base_url
108107
109- @pytest .fixture (scope = "session" )
110- def lambda_client (boto3_session : Session , lambda_runtime_url : URL ) -> BaseClient :
111- """Return a boto3 Lambda client pointing at the simulated lambda runtime."""
112- return boto3_session .client ("lambda" , endpoint_url = str (lambda_runtime_url ))
108+ subprocess .run ( # noqa: S603
109+ [docker_path , "compose" , "-f" , str (compose_file ), "rm" , "-f" , "-s" , "lambda-api" , "api-gateway-mock" ],
110+ check = False ,
111+ env = env ,
112+ capture_output = True ,
113+ text = True ,
114+ )
113115
114116
115117@pytest .fixture (scope = "session" )
@@ -134,6 +136,12 @@ def api_gateway_endpoint(request: pytest.FixtureRequest, lambda_runtime_url): #
134136 return base_url
135137
136138
139+ @pytest .fixture (scope = "session" )
140+ def lambda_client (boto3_session : Session , lambda_runtime_url : URL ) -> BaseClient :
141+ """Return a boto3 Lambda client pointing at the simulated lambda runtime."""
142+ return boto3_session .client ("lambda" , endpoint_url = str (lambda_runtime_url ))
143+
144+
137145@pytest .fixture
138146def lambda_logs (docker_services ) -> Callable [[], list [str ]]:
139147 """Return a callable that fetches the latest lambda-api logs."""
@@ -168,5 +176,4 @@ def get_lambda_logs(docker_services) -> list[str]: # noqa :ARG001
168176 text = True ,
169177 check = False ,
170178 )
171-
172- return [line .partition ("|" )[- 1 ].strip () for line in result .stdout .splitlines ()]
179+ return [line .split ("|" , 1 )[- 1 ].strip () for line in result .stdout .splitlines ()]
0 commit comments