MCPcopy Create free account
hub / github.com/celery/celery / test_cleanup

Method test_cleanup

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

Source from the content-addressed store, hash-verified

938 assert tb.restore_group(tid) == res
939
940 def test_cleanup(self):
941 tb = DatabaseBackend(self.uri, app=self.app)
942 for i in range(10):
943 tb.mark_as_done(uuid(), 42)
944 tb.save_group(uuid(), {'foo': 'bar'})
945 s = tb.ResultSession()
946 for t in s.query(Task).all():
947 t.date_done = datetime.now() - tb.expires * 2
948 for t in s.query(TaskSet).all():
949 t.date_done = datetime.now() - tb.expires * 2
950 s.commit()
951 s.close()
952
953 tb.cleanup()
954
955 def test_cleanup_respects_timezone_for_expiration(self):
956 """Regression test for timezone bug where cleanup uses app.now() while date_done is UTC."""

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