Skip to content

Commit cd46161

Browse files
committed
fix value error and add unit test
1 parent 91c8db4 commit cd46161

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

datajoint/autopopulate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ def handler(signum, frame):
213213
if not nkeys:
214214
return
215215

216-
if processes > 1:
217-
processes = min(*(_ for _ in (processes, nkeys, mp.cpu_count()) if _))
216+
processes = min(*(_ for _ in (processes, nkeys, mp.cpu_count()) if _))
218217

219218
error_list = []
220219
populate_kwargs = dict(

tests/test_autopopulate.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ def test_multi_processing(self):
6969
== len(self.subject) * self.experiment.fake_experiments_per_subject
7070
)
7171

72+
def test_max_multi_processing(self):
73+
assert self.subject, "root tables are empty"
74+
assert not self.experiment, "table already filled?"
75+
self.experiment.populate(processes=None)
76+
assert (
77+
len(self.experiment)
78+
== len(self.subject) * self.experiment.fake_experiments_per_subject
79+
)
80+
7281
@raises(DataJointError)
7382
def test_allow_insert(self):
7483
assert_true(self.subject, "root tables are empty")

0 commit comments

Comments
 (0)