Unit tests break with celery 5.4.0
See the pipeline error here: https://git.ligo.org/emfollow/gwcelery/-/jobs/3305199
=================================== FAILURES ===================================
________________________________ test_flask_run ________________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fa37442e190>
def test_flask_run(monkeypatch):
"""Test starting the Flask server from the command line."""
mock_run_simple = Mock()
monkeypatch.setattr('flask.cli.run_simple', mock_run_simple)
monkeypatch.setenv('FLASK_RUN_PORT', '5556')
monkeypatch.setattr(celery_app.log, 'setup', Mock())
> main(['gwcelery', 'flask', 'run'])
gwcelery/tests/test_tools_flask.py:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gwcelery/__init__.py:42: in main
app.start(argv) # The application can take it from here!
/usr/local/lib/python3.11/site-packages/celery/app/base.py:371: in start
celery.main(args=argv, standalone_mode=False)
/usr/local/lib/python3.11/site-packages/click/core.py:1078: in main
rv = self.invoke(ctx)
/usr/local/lib/python3.11/site-packages/click/core.py:1686: in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
/usr/local/lib/python3.11/site-packages/flask/cli.py:635: in make_context
return super().make_context(info_name, args, parent=parent, **extra)
/usr/local/lib/python3.11/site-packages/click/core.py:943: in make_context
self.parse_args(ctx, args)
/usr/local/lib/python3.11/site-packages/flask/cli.py:645: in parse_args
return super().parse_args(ctx, args)
/usr/local/lib/python3.11/site-packages/click/core.py:1644: in parse_args
rest = super().parse_args(ctx, args)
/usr/local/lib/python3.11/site-packages/click/core.py:1408: in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
/usr/local/lib/python3.11/site-packages/click/core.py:2400: in handle_parse_result
value = self.process_value(ctx, value)
/usr/local/lib/python3.11/site-packages/click/core.py:2362: in process_value
value = self.callback(ctx, self, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <DaemonOption logfile>
ctx = <click.core.Context object at 0x7fa37442fe90>
opt = <DaemonOption logfile>, value = None
def daemon_setting(self, ctx: Context, opt: CeleryOption, value: Any) -> Any:
"""
Try to fetch deamonization option from applications settings.
Use the daemon command name as prefix (eg. `worker` -> `worker_pidfile`)
"""
> return value or getattr(ctx.obj.app.conf, f"{ctx.command.name}_{self.name}", None)
E AttributeError: 'ScriptInfo' object has no attribute 'app'
/usr/local/lib/python3.11/site-packages/celery/bin/base.py:187: AttributeError