ソースを参照

Recreate MPFuture locks after killing leftover children in tests

Aleksandr Borzunov 4 年 前
コミット
93e4ccd145
1 ファイル変更6 行追加0 行削除
  1. 6 0
      tests/conftest.py

+ 6 - 0
tests/conftest.py

@@ -1,10 +1,12 @@
 import gc
+import multiprocessing as mp
 from contextlib import suppress
 
 import psutil
 import pytest
 
 from hivemind.utils import get_logger
+from hivemind.utils.mpfuture import MPFuture
 
 
 logger = get_logger(__name__)
@@ -26,3 +28,7 @@ def cleanup_children():
         for child in children:
             with suppress(psutil.NoSuchProcess):
                 child.kill()
+
+    # Killing child processes may leave the global MPFuture locks acquired, so we recreate them
+    MPFuture._initialization_lock = mp.Lock()
+    MPFuture._update_lock = mp.Lock()