def test_install_default_entries(self): with patch_settings(CELERY_TASK_RESULT_EXPIRES=None, CELERYBEAT_SCHEDULE={}): s = mScheduler() s.install_default_entries({}) self.assertNotIn('celery.backend_cleanup', s.data) with patch_settings(CELERY_TASK_RESULT_EXPIRES=30, CELERYBEAT_SCHEDULE={}): s = mScheduler() s.install_default_entries({}) self.assertIn('celery.backend_cleanup', s.data)
def test_install_default_entries(self): with patch_settings(CELERY_TASK_RESULT_EXPIRES=None, CELERYBEAT_SCHEDULE={}): s = mScheduler() s.install_default_entries({}) self.assertNotIn('celery.backend_cleanup', s.data) current_app.backend.supports_autoexpire = False with patch_settings(CELERY_TASK_RESULT_EXPIRES=30, CELERYBEAT_SCHEDULE={}): s = mScheduler() s.install_default_entries({}) self.assertIn('celery.backend_cleanup', s.data) current_app.backend.supports_autoexpire = True try: with patch_settings(CELERY_TASK_RESULT_EXPIRES=31, CELERYBEAT_SCHEDULE={}): s = mScheduler() s.install_default_entries({}) self.assertNotIn('celery.backend_cleanup', s.data) finally: current_app.backend.supports_autoexpire = False