@@ -81,14 +81,17 @@ def get_uwsgi_config(process: Process, config_file: str) -> TextIO:
8181 assert "uwsgi: my.ini" == get_application_name (process_with_cmdline (["uwsgi" , "a" , "b" , "--ini" , "my.ini" ]))
8282
8383
84- def test_celery () -> None :
84+ def test_celery_with_app () -> None :
8585 # celery -A
8686 assert f"celery: app1 ({ PROCESS_CWD } /app1.py)" == get_application_name (
8787 process_with_cmdline (["celery" , "a" , "b" , "-A" , "app1" ])
8888 )
8989 assert "celery: /path/to/app1 (/path/to/app1.py)" == get_application_name (
9090 process_with_cmdline (["celery" , "a" , "b" , "-A" , "/path/to/app1" ])
9191 )
92+ assert "celery: /path/to/app1 (/path/to/app1.py)" == get_application_name (
93+ process_with_cmdline (["celery" , "a" , "b" , "-A/path/to/app1" ])
94+ )
9295 # python celery -A
9396 assert f"celery: app1 ({ PROCESS_CWD } /app1.py)" == get_application_name (
9497 process_with_cmdline (["python" , "/path/to/celery" , "a" , "b" , "-A" , "app1" ])
@@ -110,7 +113,36 @@ def test_celery() -> None:
110113 assert "celery: /path/to/app3 (/path/to/app3.py)" == get_application_name (
111114 process_with_cmdline (["celery" , "a" , "b" , "--app=/path/to/app3" ])
112115 )
113- # No app
116+
117+
118+ def test_celery_with_queue () -> None :
119+ # celery -Q queue
120+ assert f"celery queue: qqq ({ PROCESS_CWD } )" == get_application_name (
121+ process_with_cmdline (["celery" , "a" , "b" , "-Q" , "qqq" ])
122+ )
123+ # celery -Qqueue
124+ assert f"celery queue: qqq ({ PROCESS_CWD } )" == get_application_name (
125+ process_with_cmdline (["celery" , "a" , "b" , "-Qqqq" ])
126+ )
127+ # python celery -Q queue
128+ assert f"celery queue: qqq ({ PROCESS_CWD } )" == get_application_name (
129+ process_with_cmdline (["python" , "/path/to/celery" , "a" , "b" , "-Q" , "qqq" ])
130+ )
131+ # --queues queue
132+ assert f"celery queue: qqq ({ PROCESS_CWD } )" == get_application_name (
133+ process_with_cmdline (["celery" , "a" , "b" , "--queues" , "qqq" ])
134+ )
135+ # --queues=queue
136+ assert f"celery queue: qqq ({ PROCESS_CWD } )" == get_application_name (
137+ process_with_cmdline (["celery" , "a" , "b" , "--queues=qqq" ])
138+ )
139+ # multiple queues
140+ assert f"celery queue: qqq,www ({ PROCESS_CWD } )" == get_application_name (
141+ process_with_cmdline (["celery" , "a" , "b" , "-Q" , "qqq,www" ])
142+ )
143+
144+
145+ def test_celery_without_app () -> None :
114146 assert get_application_name (process_with_cmdline (["celery" , "a" , "b" ])) is None
115147
116148
0 commit comments