MCPcopy
hub / github.com/celery/celery / test_cleanup

Method test_cleanup

t/unit/backends/test_database.py:388–401  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

386 assert tb.restore_group('xxx-nonexisting-id') is None
387
388 def test_cleanup(self):
389 tb = DatabaseBackend(self.uri, app=self.app)
390 for i in range(10):
391 tb.mark_as_done(uuid(), 42)
392 tb.save_group(uuid(), {'foo': 'bar'})
393 s = tb.ResultSession()
394 for t in s.query(Task).all():
395 t.date_done = datetime.now() - tb.expires * 2
396 for t in s.query(TaskSet).all():
397 t.date_done = datetime.now() - tb.expires * 2
398 s.commit()
399 s.close()
400
401 tb.cleanup()
402
403 def test_Task__repr__(self):
404 assert 'foo' in repr(Task('foo'))

Callers

nothing calls this directly

Calls 7

ResultSessionMethod · 0.95
cleanupMethod · 0.95
DatabaseBackendClass · 0.90
mark_as_doneMethod · 0.80
save_groupMethod · 0.45
nowMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected