jason810496 commented on code in PR #52929:
URL: https://github.com/apache/airflow/pull/52929#discussion_r2190302582
##########
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:
`--dev` flag needs to mock `subprocess.Popen`, resolve.
--
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]