Skip to content

Commit 4971e56

Browse files
committed
Tear down worker process group in instance fixture
Signed-off-by: Samuel Monson <[email protected]>
1 parent 5032e9e commit 4971e56

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/unit/scheduler/test_worker_group.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,19 @@ def valid_instances(self, request):
163163
"""Fixture providing test data for WorkerProcessGroup."""
164164
constructor_args = request.param.copy()
165165
instance = WorkerProcessGroup(**request.param, backend=MockBackend())
166-
return instance, constructor_args
166+
yield instance, constructor_args
167+
168+
# Shutting down. Attempting shut down.
169+
try:
170+
if hasattr(instance, "processes") and instance.processes is not None:
171+
asyncio.run(instance.shutdown())
172+
# It's not...it's-it's not...it's not shutting down...it's not...
173+
except Exception: # noqa: BLE001
174+
if hasattr(instance, "processes") and instance.processes is not None:
175+
# Gahhh...!
176+
for proc in instance.processes:
177+
proc.kill()
178+
proc.join(timeout=1.0)
167179

168180
@pytest.mark.smoke
169181
def test_class_signatures(self, valid_instances):

0 commit comments

Comments
 (0)