mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
* info before error * core.logging usage
This commit is contained in:
parent
480adf8100
commit
6743d8df4f
@ -7,6 +7,7 @@ import pytest
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from akkudoktoreos.core.ems import get_ems
|
from akkudoktoreos.core.ems import get_ems
|
||||||
|
from akkudoktoreos.core.logging import get_logger
|
||||||
from akkudoktoreos.prediction.elecpriceakkudoktor import (
|
from akkudoktoreos.prediction.elecpriceakkudoktor import (
|
||||||
AkkudoktorElecPrice,
|
AkkudoktorElecPrice,
|
||||||
AkkudoktorElecPriceValue,
|
AkkudoktorElecPriceValue,
|
||||||
@ -21,6 +22,8 @@ FILE_TESTDATA_ELECPRICEAKKUDOKTOR_1_JSON = DIR_TESTDATA.joinpath(
|
|||||||
"elecpriceforecast_akkudoktor_1.json"
|
"elecpriceforecast_akkudoktor_1.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def provider(monkeypatch, config_eos):
|
def provider(monkeypatch, config_eos):
|
||||||
@ -145,6 +148,7 @@ def test_update_data_with_incomplete_forecast(mock_get, provider):
|
|||||||
mock_response.status_code = 200
|
mock_response.status_code = 200
|
||||||
mock_response.content = json.dumps(incomplete_data)
|
mock_response.content = json.dumps(incomplete_data)
|
||||||
mock_get.return_value = mock_response
|
mock_get.return_value = mock_response
|
||||||
|
logger.info("The following errors are intentional and part of the test.")
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
provider._update_data(force_update=True)
|
provider._update_data(force_update=True)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from unittest.mock import Mock, patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from akkudoktoreos.core.ems import get_ems
|
from akkudoktoreos.core.ems import get_ems
|
||||||
|
from akkudoktoreos.core.logging import get_logger
|
||||||
from akkudoktoreos.prediction.prediction import get_prediction
|
from akkudoktoreos.prediction.prediction import get_prediction
|
||||||
from akkudoktoreos.prediction.pvforecastakkudoktor import (
|
from akkudoktoreos.prediction.pvforecastakkudoktor import (
|
||||||
AkkudoktorForecastHorizon,
|
AkkudoktorForecastHorizon,
|
||||||
@ -20,6 +21,8 @@ DIR_TESTDATA = Path(__file__).absolute().parent.joinpath("testdata")
|
|||||||
FILE_TESTDATA_PV_FORECAST_INPUT_1 = DIR_TESTDATA.joinpath("pv_forecast_input_1.json")
|
FILE_TESTDATA_PV_FORECAST_INPUT_1 = DIR_TESTDATA.joinpath("pv_forecast_input_1.json")
|
||||||
FILE_TESTDATA_PV_FORECAST_RESULT_1 = DIR_TESTDATA.joinpath("pv_forecast_result_1.txt")
|
FILE_TESTDATA_PV_FORECAST_RESULT_1 = DIR_TESTDATA.joinpath("pv_forecast_result_1.txt")
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sample_settings(config_eos):
|
def sample_settings(config_eos):
|
||||||
@ -223,6 +226,7 @@ def test_pvforecast_akkudoktor_data_record():
|
|||||||
|
|
||||||
def test_pvforecast_akkudoktor_validate_data(provider_empty_instance, sample_forecast_data_raw):
|
def test_pvforecast_akkudoktor_validate_data(provider_empty_instance, sample_forecast_data_raw):
|
||||||
"""Test validation of PV forecast data on sample data."""
|
"""Test validation of PV forecast data on sample data."""
|
||||||
|
logger.info("The following errors are intentional and part of the test.")
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
ValueError,
|
ValueError,
|
||||||
match="Field: meta\nError: Field required\nType: missing\nField: values\nError: Field required\nType: missing\n",
|
match="Field: meta\nError: Field required\nType: missing\nField: values\nError: Field required\nType: missing\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user