major overhaul of forecast pipeline #21
@ -1,17 +1,15 @@
|
|||||||
import importlib
|
|
||||||
import json
|
import json
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import sqlalchemy as sql
|
import sqlalchemy as sql
|
||||||
|
|
||||||
import delta_barth.pipelines
|
|
||||||
from delta_barth import databases as db
|
from delta_barth import databases as db
|
||||||
from delta_barth import pipelines as pl
|
from delta_barth import pipelines as pl
|
||||||
from delta_barth.errors import STATUS_HANDLER
|
from delta_barth.errors import STATUS_HANDLER
|
||||||
|
|
||||||
|
|
||||||
def test_write_performance_metrics(session):
|
def test_write_performance_metrics_Success(session):
|
||||||
pipe_name = "test_pipe"
|
pipe_name = "test_pipe"
|
||||||
t_start = 20_000_000_000
|
t_start = 20_000_000_000
|
||||||
t_end = 30_000_000_000
|
t_end = 30_000_000_000
|
||||||
@ -33,6 +31,20 @@ def test_write_performance_metrics(session):
|
|||||||
assert metrics.execution_duration == 10
|
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)
|
@patch("delta_barth.analysis.forecast.SALES_BASE_NUM_DATAPOINTS_MONTHS", 1)
|
||||||
def test_sales_prognosis_pipeline(exmpl_api_sales_prognosis_resp, session):
|
def test_sales_prognosis_pipeline(exmpl_api_sales_prognosis_resp, session):
|
||||||
with patch(
|
with patch(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user