Skip to content

Commit

Permalink
Force the default start method to spawn
Browse files Browse the repository at this point in the history
This will no longer be necessary in python 3.14 but for now doing
this removes some deprecation warnings from the multiprocessing
tests.
  • Loading branch information
timj committed Nov 29, 2023
1 parent 06e5cf3 commit 7342d99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import faulthandler
import logging
import multiprocessing
import os
import signal
import sys
Expand Down Expand Up @@ -704,5 +705,11 @@ def test_clobber_outputs_execute(self) -> None:
self.assertEqual(dataset_id_1, dataset_id_3)


def setup_module(module):
"""Force spawn to be used if no method given explicitly."""
multiprocessing.set_start_method("spawn", force=True)


if __name__ == "__main__":
multiprocessing.set_start_method("spawn")
unittest.main()

0 comments on commit 7342d99

Please sign in to comment.