Spaces:
Sleeping
Sleeping
File size: 634 Bytes
0ac2632 e19093d 0ac2632 1180a53 0ac2632 1180a53 0ac2632 1180a53 0ac2632 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import os
import shutil
import pytest
from src.train_model import train_model
MODEL_DIR = "models/sentiment_model"
@pytest.fixture(autouse=True)
def cleanup():
if os.path.exists(MODEL_DIR):
shutil.rmtree(MODEL_DIR)
yield
if os.path.exists(MODEL_DIR):
shutil.rmtree(MODEL_DIR)
def test_train_model_runs():
"""Testa che il training parta e salvi un modello."""
train_model(sample_train_size=10, sample_eval_size=5)
assert os.path.exists(MODEL_DIR), "La directory del modello non è stata creata"
assert os.path.exists(os.path.join(MODEL_DIR, "config.json")), "File config.json mancante"
|