def test_postponed(db): cache = Cache(db, write='on_exit') sess = Session([cache]) with sess: sess.eval(analysis(calcs()), task_filter=lambda t: t.label[0] != '/') assert len(cache._objects) == 23 assert not cache._objects
def test_db_files(db, tmpdir, mocker): sess = Session([Cache(db), FileManager(tmpdir)]) with sess: sess.eval(analysis(calcs2())) mocker.patch.object(sess, 'run_task') with sess: sess.eval(analysis(calcs2())) assert not sess.run_task.called
def test_db(db, mocker): sess = Session([Cache(db)]) with sess: sess.eval(analysis(calcs())) mocker.patch.object(sess, 'run_task') with sess: assert sess.eval(analysis(calcs())) == 20 assert not sess.run_task.called