- Added a new fixture to manage runtime report artifacts in a writable temp directory during E2E tests, addressing permission issues in local CI/dev environments. - Updated `conftest.py` to include a requirements.txt file in the model packaging path for training activities. - Refactored existing fixtures to use `pytest.fixture` instead of `pytest_asyncio.fixture` for better compatibility. - Enhanced the `Reports` class to include a target alias for report metrics, ensuring compatibility with Evidently's reporting requirements. - Introduced new test scenarios to validate the handling of missing and whitespace-only `date_column` inputs in the training workflow. These changes improve the robustness of the E2E testing framework and enhance the clarity of model reporting metrics.
76 lines
3.0 KiB
Python
76 lines
3.0 KiB
Python
"""Unit tests for ExperimentStatus enum."""
|
|
|
|
from model_manager.utils.models.experiment_status import ExperimentStatus
|
|
|
|
|
|
def test_experiment_status_values():
|
|
"""Test that all expected status values exist."""
|
|
assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR == 'ORCHESTRATOR_VALIDATION_ERROR'
|
|
assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC == 'ORCHESTRATOR_WAITING_PROC'
|
|
assert ExperimentStatus.TRAINING_SUCCESS == 'TRAINING_SUCCESS'
|
|
assert ExperimentStatus.TRAINING_ERROR == 'TRAINING_ERROR'
|
|
|
|
|
|
def test_experiment_status_count():
|
|
"""Test that enum has exactly 4 status values."""
|
|
assert len(ExperimentStatus) == 4
|
|
|
|
|
|
def test_experiment_status_is_string():
|
|
"""Test that enum values are strings."""
|
|
for status in ExperimentStatus:
|
|
assert isinstance(status.value, str)
|
|
assert isinstance(status, str)
|
|
|
|
|
|
def test_experiment_status_membership():
|
|
"""Test membership checks for status values."""
|
|
assert 'ORCHESTRATOR_VALIDATION_ERROR' in [s.value for s in ExperimentStatus]
|
|
assert 'ORCHESTRATOR_WAITING_PROC' in [s.value for s in ExperimentStatus]
|
|
assert 'TRAINING_SUCCESS' in [s.value for s in ExperimentStatus]
|
|
assert 'TRAINING_ERROR' in [s.value for s in ExperimentStatus]
|
|
|
|
|
|
def test_experiment_status_iteration():
|
|
"""Test that enum can be iterated."""
|
|
statuses = list(ExperimentStatus)
|
|
assert len(statuses) == 4
|
|
assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR in statuses
|
|
assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC in statuses
|
|
assert ExperimentStatus.TRAINING_SUCCESS in statuses
|
|
assert ExperimentStatus.TRAINING_ERROR in statuses
|
|
|
|
|
|
def test_experiment_status_comparison():
|
|
"""Test that enum values can be compared with strings."""
|
|
assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR == 'ORCHESTRATOR_VALIDATION_ERROR'
|
|
assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC == 'ORCHESTRATOR_WAITING_PROC'
|
|
assert ExperimentStatus.TRAINING_SUCCESS == 'TRAINING_SUCCESS'
|
|
assert str(ExperimentStatus.TRAINING_ERROR) != 'TRAINING_SUCCESS'
|
|
|
|
|
|
def test_experiment_status_access_by_name():
|
|
"""Test accessing enum members by name."""
|
|
assert (
|
|
ExperimentStatus['ORCHESTRATOR_VALIDATION_ERROR']
|
|
== ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR
|
|
)
|
|
assert (
|
|
ExperimentStatus['ORCHESTRATOR_WAITING_PROC'] == ExperimentStatus.ORCHESTRATOR_WAITING_PROC
|
|
)
|
|
assert ExperimentStatus['TRAINING_SUCCESS'] == ExperimentStatus.TRAINING_SUCCESS
|
|
assert ExperimentStatus['TRAINING_ERROR'] == ExperimentStatus.TRAINING_ERROR
|
|
|
|
|
|
def test_experiment_status_access_by_value():
|
|
"""Test accessing enum members by value."""
|
|
assert (
|
|
ExperimentStatus('ORCHESTRATOR_VALIDATION_ERROR')
|
|
== ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR
|
|
)
|
|
assert (
|
|
ExperimentStatus('ORCHESTRATOR_WAITING_PROC') == ExperimentStatus.ORCHESTRATOR_WAITING_PROC
|
|
)
|
|
assert ExperimentStatus('TRAINING_SUCCESS') == ExperimentStatus.TRAINING_SUCCESS
|
|
assert ExperimentStatus('TRAINING_ERROR') == ExperimentStatus.TRAINING_ERROR
|