diff --git a/tests/test_pipelines.py b/tests/test_pipelines.py index b1387b7..e1e8b1e 100644 --- a/tests/test_pipelines.py +++ b/tests/test_pipelines.py @@ -1,17 +1,15 @@ -import importlib import json from unittest.mock import patch import pytest import sqlalchemy as sql -import delta_barth.pipelines from delta_barth import databases as db from delta_barth import pipelines as pl from delta_barth.errors import STATUS_HANDLER -def test_write_performance_metrics(session): +def test_write_performance_metrics_Success(session): pipe_name = "test_pipe" t_start = 20_000_000_000 t_end = 30_000_000_000 @@ -33,6 +31,20 @@ def test_write_performance_metrics(session): assert metrics.execution_duration == 10 +def test_write_performance_metrics_FailStartingTime(session): + pipe_name = "test_pipe" + t_start = 30_000_000_000 + t_end = 20_000_000_000 + + with patch("delta_barth.pipelines.SESSION", session): + with pytest.raises(ValueError): + _ = pl._write_performance_metrics( + pipeline_name=pipe_name, + time_start=t_start, + time_end=t_end, + ) + + @patch("delta_barth.analysis.forecast.SALES_BASE_NUM_DATAPOINTS_MONTHS", 1) def test_sales_prognosis_pipeline(exmpl_api_sales_prognosis_resp, session): with patch(