add edge case for unittest in pipeline
This commit is contained in:
parent
3c8f18e4e3
commit
670e2e549f
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user