test(neuron): add helper to batch export models

Also rename fixture file fro clarity.
This commit is contained in:
David Corvoysier 2025-02-24 17:37:37 +00:00
parent 70e846d53b
commit 53c1226939
2 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
pytest_plugins = ["fixtures.neuron.service", "fixtures.neuron.model"] pytest_plugins = ["fixtures.neuron.service", "fixtures.neuron.export_models"]
# ruff: noqa: E402 # ruff: noqa: E402
from _pytest.fixtures import SubRequest from _pytest.fixtures import SubRequest
import requests import requests

View File

@ -216,6 +216,11 @@ def maybe_export_model(config_name, model_config):
return neuron_model_id return neuron_model_id
def maybe_export_models():
for config_name, model_config in MODEL_CONFIGURATIONS.items():
maybe_export_model(config_name, model_config)
@pytest.fixture(scope="session", params=MODEL_CONFIGURATIONS.keys()) @pytest.fixture(scope="session", params=MODEL_CONFIGURATIONS.keys())
def neuron_model_config(request): def neuron_model_config(request):
"""Expose a pre-trained neuron model """Expose a pre-trained neuron model
@ -262,3 +267,7 @@ def neuron_model_config(request):
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def neuron_model_path(neuron_model_config): def neuron_model_path(neuron_model_config):
yield neuron_model_config["neuron_model_path"] yield neuron_model_config["neuron_model_path"]
if __name__ == "__main__":
maybe_export_models()