Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Shared isolation for tests that use TCT's runtime configuration."""

from collections.abc import Iterator

import pytest

from TCT.config import configure, reset_config


@pytest.fixture(autouse=True)
def isolated_runtime_config() -> Iterator[None]:
"""Give every test an explicit runtime independent of ambient state."""
configure(environment="prod")
yield
reset_config()
9 changes: 1 addition & 8 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
)
from TCT.translator_kpinfo import _select_provider_url


@pytest.fixture(autouse=True)
def clean_runtime_config():
reset_config()
yield
reset_config()


def test_prod_ci_and_test_endpoint_resolution():
prod = RuntimeConfig(environment="prod")
ci = RuntimeConfig(environment="ci")
Expand Down Expand Up @@ -52,6 +44,7 @@ def test_environment_variable_selects_ci(monkeypatch):

def test_ci_is_the_default_environment(monkeypatch):
monkeypatch.delenv("TCT_ENVIRONMENT", raising=False)
reset_config()

assert RuntimeConfig().environment == "ci"
assert load_config().environment == "ci"
Expand Down
14 changes: 12 additions & 2 deletions tests/test_node_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ def use_node_annotator_prod():
'curie': 'CHEBI:15377',
'expected': {
'query': 'CHEBI:15377',
'boxed_warning': True,
'sections': ['aeolus', 'chebi', 'chembl', 'clinical_approval', 'clinical_trials', 'drugbank', 'ndc', 'pubchem', 'unichem', 'unii'],
# Warning and clinical approval/trial fields depend on volatile
# upstream providers and are not part of the stable contract.
'sections': [
'aeolus',
'chebi',
'chembl',
'drugbank',
'ndc',
'pubchem',
'unichem',
'unii',
],
'chembl.availability_type': 2,
},
},
Expand Down
Loading