Skip to content

Commit e82f6c5

Browse files
committed
director
1 parent a66d032 commit e82f6c5

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

services/api-server/tests/unit/test_core_settings.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ def app_environment(
1818
app_environment: EnvVarsDict,
1919
external_envfile_dict: EnvVarsDict,
2020
) -> EnvVarsDict:
21-
"""
22-
NOTE: To run against repo.config in osparc-config repo
21+
"""OVERRIDES app_environment fixture:
2322
24-
ln -s /path/to/osparc-config/deployments/mydeploy.com/repo.config .secrets
25-
pytest --external-envfile=.secrets tests/unit/test_core_settings.py
23+
Enables using external envfiles (e.g. repo.config files) to run tests against
24+
within this test module.
2625
"""
2726
if external_envfile_dict:
2827
delenvs_from_dict(monkeypatch, app_environment, raising=False)

services/director/tests/unit/test_core_settings.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,35 @@
99
import pytest
1010
from pydantic import ValidationError
1111
from pytest_simcore.helpers.monkeypatch_envs import (
12+
delenvs_from_dict,
1213
setenvs_from_dict,
1314
setenvs_from_envfile,
1415
)
1516
from pytest_simcore.helpers.typing_env import EnvVarsDict
1617
from simcore_service_director.core.settings import ApplicationSettings
1718

1819

19-
def test_valid_web_application_settings(app_environment: EnvVarsDict):
20+
@pytest.fixture
21+
def app_environment(
22+
monkeypatch: pytest.MonkeyPatch,
23+
app_environment: EnvVarsDict,
24+
external_envfile_dict: EnvVarsDict,
25+
) -> EnvVarsDict:
26+
"""OVERRIDES app_environment fixture:
27+
28+
Enables using external envfiles (e.g. repo.config files) to run tests against
29+
within this test module.
30+
"""
31+
if external_envfile_dict:
32+
delenvs_from_dict(monkeypatch, app_environment, raising=False)
33+
return setenvs_from_dict(
34+
monkeypatch,
35+
{**external_envfile_dict},
36+
)
37+
return app_environment
38+
39+
40+
def test_valid_application_settings(app_environment: EnvVarsDict):
2041
"""
2142
We validate actual envfiles (e.g. repo.config files) by passing them via the CLI
2243

0 commit comments

Comments
 (0)