Skip to content

Commit ed2755d

Browse files
committed
changed wrong stuff
1 parent 682cb1b commit ed2755d

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

services/director/tests/conftest.py

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# pylint: disable=unused-variable
44
# pylint: disable=too-many-arguments
55

6-
import os
76
from collections.abc import AsyncIterator
87
from pathlib import Path
98

@@ -13,7 +12,6 @@
1312
from fastapi import FastAPI
1413
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
1514
from pytest_simcore.helpers.typing_env import EnvVarsDict
16-
from simcore_service_director import config, resources
1715
from simcore_service_director.core.application import create_app
1816
from simcore_service_director.core.settings import ApplicationSettings
1917

@@ -59,45 +57,56 @@ def common_schemas_specs_dir(osparc_simcore_root_dir: Path) -> Path:
5957
return specs_dir
6058

6159

62-
@pytest.fixture
63-
def configure_schemas_location(
64-
installed_package_dir: Path, common_schemas_specs_dir: Path
65-
) -> None:
66-
config.NODE_SCHEMA_LOCATION = str(
67-
common_schemas_specs_dir / "node-meta-v0.0.1.json"
68-
)
69-
resources.RESOURCE_NODE_SCHEMA = os.path.relpath(
70-
config.NODE_SCHEMA_LOCATION, installed_package_dir
71-
)
72-
73-
7460
@pytest.fixture(scope="session")
75-
def configure_swarm_stack_name() -> None:
76-
config.SWARM_STACK_NAME = "test_stack"
61+
def configure_swarm_stack_name(monkeypatch: pytest.MonkeyPatch) -> EnvVarsDict:
62+
return setenvs_from_dict(monkeypatch, envs={"SWARM_STACK_NAME": "test_stack"})
7763

7864

7965
@pytest.fixture
80-
def configure_registry_access(docker_registry: str) -> None:
81-
config.REGISTRY_URL = docker_registry
82-
config.REGISTRY_PATH = docker_registry
83-
config.REGISTRY_SSL = False
84-
config.DIRECTOR_REGISTRY_CACHING = False
66+
def configure_registry_access(
67+
monkeypatch: pytest.MonkeyPatch, docker_registry: str
68+
) -> EnvVarsDict:
69+
return setenvs_from_dict(
70+
monkeypatch,
71+
envs={
72+
"REGISTRY_URL": docker_registry,
73+
"REGISTRY_PATH": docker_registry,
74+
"REGISTRY_SSL": False,
75+
"DIRECTOR_REGISTRY_CACHING": False,
76+
},
77+
)
8578

8679

8780
@pytest.fixture(scope="session")
88-
def configure_custom_registry(pytestconfig: pytest.Config) -> None:
81+
def configure_custom_registry(
82+
monkeypatch: pytest.MonkeyPatch, pytestconfig: pytest.Config
83+
) -> EnvVarsDict:
8984
# to set these values call
9085
# pytest --registry_url myregistry --registry_user username --registry_pw password
91-
config.REGISTRY_URL = pytestconfig.getoption("registry_url")
92-
config.REGISTRY_AUTH = True
93-
config.REGISTRY_USER = pytestconfig.getoption("registry_user")
94-
config.REGISTRY_PW = pytestconfig.getoption("registry_pw")
95-
config.DIRECTOR_REGISTRY_CACHING = False
86+
registry_url = pytestconfig.getoption("registry_url")
87+
assert registry_url
88+
assert isinstance(registry_url, str)
89+
registry_user = pytestconfig.getoption("registry_user")
90+
assert registry_user
91+
assert isinstance(registry_user, str)
92+
registry_pw = pytestconfig.getoption("registry_pw")
93+
assert registry_pw
94+
assert isinstance(registry_pw, str)
95+
return setenvs_from_dict(
96+
monkeypatch,
97+
envs={
98+
"REGISTRY_URL": registry_url,
99+
"REGISTRY_AUTH": True,
100+
"REGISTRY_USER": registry_user,
101+
"REGISTRY_PW": registry_pw,
102+
"REGISTRY_SSL": False,
103+
"DIRECTOR_REGISTRY_CACHING": False,
104+
},
105+
)
96106

97107

98108
@pytest.fixture
99109
def api_version_prefix() -> str:
100-
assert "v0" in resources.listdir(resources.RESOURCE_OPENAPI_ROOT)
101110
return "v0"
102111

103112

0 commit comments

Comments
 (0)