Copilot commented on code in PR #52929:
URL: https://github.com/apache/airflow/pull/52929#discussion_r2188054419
##########
airflow-core/src/airflow/cli/commands/api_server_command.py:
##########
@@ -112,7 +140,7 @@ def api_server(args):
timeout_graceful_shutdown=worker_timeout,
ssl_keyfile=ssl_key,
ssl_certfile=ssl_cert,
- access_log=access_logfile,
+ access_log=access_logfile, # type: ignore [arg-type]
Review Comment:
Rather than using a `# type: ignore`, consider casting `access_logfile` to
the correct type (e.g., `str`) or adjusting its annotation so `access_log`
receives a matching type.
```suggestion
access_log=access_logfile,
```
##########
airflow-core/tests/unit/cli/commands/test_api_server_command.py:
##########
@@ -75,49 +75,57 @@ def test_dev_arg(self, args, expected_command):
close_fds=True,
)
- def test_apps_env_var_set_unset(self):
+ @pytest.mark.parametrize(
+ "args",
+ [
+ (["api-server"]),
+ (["api-server", "--apps", "all"]),
+ (["api-server", "--apps", "core,execution"]),
+ (["api-server", "--apps", "core"]),
+ (["api-server", "--apps", "execution"]),
+ ],
+ ids=[
+ "default_apps",
+ "all_apps_explicit",
+ "multiple_apps_explicit",
+ "single_app_core",
+ "single_app_execution",
+ ],
+ )
+ @pytest.mark.parametrize("dev_mode", [True, False])
+ @pytest.mark.parametrize(
+ "original_env",
+ [None, "some_value"],
+ )
+ def test_api_apps_env(self, args, dev_mode, original_env):
"""
Test that AIRFLOW_API_APPS is set and unset in the environment when
calling the airflow api-server command
"""
+
+ if dev_mode:
+ args.append("--dev")
+
with (
- mock.patch("subprocess.Popen") as Popen,
mock.patch("os.environ", autospec=True) as mock_environ,
+ mock.patch("uvicorn.run"),
+ mock.patch("subprocess.Popen"),
Review Comment:
There are two patches for `subprocess.Popen` in this `with` blockāone named
(`as Popen`) and one anonymous. Removing the duplicate anonymous patch will
reduce confusion.
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]