1+ # pylint:disable=redefined-outer-name
12# pylint:disable=unused-argument
23
34import os
@@ -29,7 +30,9 @@ def test_cli_help_and_version(cli_runner: CliRunner):
2930 assert result .stdout .strip () == API_VERSION
3031
3132
32- def test_echo_dotenv (cli_runner : CliRunner , monkeypatch : pytest .MonkeyPatch ):
33+ def test_echo_dotenv (
34+ app_environment : EnvVarsDict , cli_runner : CliRunner , monkeypatch : pytest .MonkeyPatch
35+ ):
3336 # simcore-service-dynamic-scheduler echo-dotenv
3437 result = cli_runner .invoke (cli_main , "echo-dotenv" )
3538 assert result .exit_code == os .EX_OK , _format_cli_error (result )
@@ -38,35 +41,29 @@ def test_echo_dotenv(cli_runner: CliRunner, monkeypatch: pytest.MonkeyPatch):
3841
3942 with monkeypatch .context () as patch :
4043 setenvs_from_dict (patch , environs )
41- assert ApplicationSettings .create_from_envs ()
44+ ApplicationSettings .create_from_envs ()
45+
46+
47+ def _get_default_environs (cli_runner : CliRunner ) -> EnvVarsDict :
48+ result = cli_runner .invoke (cli_main , "echo-dotenv" )
49+ assert result .exit_code == os .EX_OK , _format_cli_error (result )
50+ return load_dotenv (result .stdout )
4251
4352
4453def test_list_settings (
4554 cli_runner : CliRunner , app_environment : EnvVarsDict , monkeypatch : pytest .MonkeyPatch
4655):
4756 with monkeypatch .context () as patch :
48- setenvs_from_dict (
49- patch ,
50- {
51- ** app_environment ,
52- "DYNAMIC_SCHEDULER_TRACING" : "{}" ,
53- "TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT" : "http://replace-with-opentelemetry-collector" ,
54- "TRACING_OPENTELEMETRY_COLLECTOR_PORT" : "4318" ,
55- },
56- )
57+ setenvs_from_dict (patch , _get_default_environs (cli_runner ))
5758
5859 # simcore-service-dynamic-scheduler settings --show-secrets --as-json
5960 result = cli_runner .invoke (
6061 cli_main , ["settings" , "--show-secrets" , "--as-json" ]
6162 )
6263 assert result .exit_code == os .EX_OK , _format_cli_error (result )
6364
64- print (result .output )
65- settings = ApplicationSettings (result .output )
66- assert settings .model_dump () == ApplicationSettings .create_from_envs ().model_dump ()
67-
68-
69- def test_main (app_environment : EnvVarsDict ):
70- from simcore_service_dynamic_scheduler .main import the_app
71-
72- assert the_app
65+ print (result .output )
66+ settings = ApplicationSettings (result .output )
67+ assert (
68+ settings .model_dump () == ApplicationSettings .create_from_envs ().model_dump ()
69+ )
0 commit comments