Coverage for /Users/ajo/work/jumpstarter/jumpstarter/conftest.py: 81%
21 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:21 +0200
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:21 +0200
1import os
2from contextlib import contextmanager
4import pytest
6os.environ["TQDM_DISABLE"] = "1"
8try:
9 from jumpstarter.common.utils import serve
10 from jumpstarter.config.exporter import ExporterConfigV1Alpha1, ExporterConfigV1Alpha1DriverInstance
11except ImportError:
12 # some packages in the workspace does not depend on jumpstarter
13 pass
14else:
16 @contextmanager
17 def run(config):
18 with serve(ExporterConfigV1Alpha1DriverInstance.from_str(config).instantiate()) as client:
19 yield client
21 @pytest.fixture(autouse=True)
22 def jumpstarter_namespace(doctest_namespace):
23 doctest_namespace["serve"] = serve
24 doctest_namespace["run"] = run
26 @pytest.fixture(autouse=True)
27 def tmp_config_path(tmp_path, monkeypatch):
28 monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path / "client-config"))
29 monkeypatch.setattr(ExporterConfigV1Alpha1, "BASE_PATH", tmp_path / "exporters")