From cd46161801524a781d528aab64a24412471833db Mon Sep 17 00:00:00 2001 From: ernaldis Date: Thu, 19 May 2022 12:01:48 -0500 Subject: [PATCH] fix value error and add unit test --- datajoint/autopopulate.py | 3 +-- tests/test_autopopulate.py | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/datajoint/autopopulate.py b/datajoint/autopopulate.py index 8d7dd900a..a5b04939c 100644 --- a/datajoint/autopopulate.py +++ b/datajoint/autopopulate.py @@ -213,8 +213,7 @@ def handler(signum, frame): if not nkeys: return - if processes > 1: - processes = min(*(_ for _ in (processes, nkeys, mp.cpu_count()) if _)) + processes = min(*(_ for _ in (processes, nkeys, mp.cpu_count()) if _)) error_list = [] populate_kwargs = dict( diff --git a/tests/test_autopopulate.py b/tests/test_autopopulate.py index f095450e4..7683e4dd0 100644 --- a/tests/test_autopopulate.py +++ b/tests/test_autopopulate.py @@ -69,6 +69,15 @@ def test_multi_processing(self): == len(self.subject) * self.experiment.fake_experiments_per_subject ) + def test_max_multi_processing(self): + assert self.subject, "root tables are empty" + assert not self.experiment, "table already filled?" + self.experiment.populate(processes=None) + assert ( + len(self.experiment) + == len(self.subject) * self.experiment.fake_experiments_per_subject + ) + @raises(DataJointError) def test_allow_insert(self): assert_true(self.subject, "root tables are empty")