programMrxu
V2EX  ›  Django

Django get_max_test_processes

By programMrxu at 2023 年 11 月 6 日 · 5356 次点击

def get_max_test_processes(): """ The maximum number of test processes when using the --parallel option. """ # The current implementation of the parallel test runner requires # multiprocessing to start subprocesses with fork() or spawn(). if multiprocessing.get_start_method() not in {"fork", "spawn"}: return 1 try: return int(os.environ["DJANGO_TEST_PROCESSES"]) except KeyError: return multiprocessing.cpu_count()

这里为什么不是 fork 或者不是 spawn ,就会返回 1 呢。

目前尚无回复
© 2026 V2EX · 24ms · 3.9.8.5