Skip to content

Commit 381da8e

Browse files
author
Thinh Nguyen
committed
add test for .populate excluding error and ignore jobs
1 parent 2790aa0 commit 381da8e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/test_autopopulate.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ def test_populate(self):
5353
assert_true(self.ephys)
5454
assert_true(self.channel)
5555

56+
def test_populate_exclude_error_and_ignore_jobs(self):
57+
# test simple populate
58+
assert_true(self.subject, "root tables are empty")
59+
assert_false(self.experiment, "table already filled?")
60+
61+
keys = self.experiment.key_source.fetch("KEY", limit=2)
62+
for idx, key in enumerate(keys):
63+
schema.jobs.insert1(
64+
{
65+
"table_name": self.experiment.table_name,
66+
"key_hash": dj.hash.key_hash(key),
67+
"status": "error" if idx == 0 else "ignore",
68+
"key": key,
69+
}
70+
)
71+
72+
self.experiment.populate(reserve_jobs=True)
73+
assert_equal(
74+
len(self.experiment.key_source & self.experiment),
75+
len(self.experiment.key_source) - 2,
76+
)
77+
5678
def test_allow_direct_insert(self):
5779
assert_true(self.subject, "root tables are empty")
5880
key = self.subject.fetch("KEY", limit=1)[0]

0 commit comments

Comments
 (0)