Completed
Push — dev ( 68ddc7...49e927 )
by Patrik
58s queued 48s
created

tests.regression_tests   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 18
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_wrong_logging_level() 0 9 2
A test_version_metadata() 0 2 1
1
# -*- coding: utf-8 -
2
3
"""Regression tests.
4
5
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted
6
by the contributors recorded in the version control history of the file,
7
available from its original location oemof/tests/regression_tests.py
8
9
SPDX-License-Identifier: MIT
10
"""
11
12
import logging
13
14
import pandas as pd
15
import pytest
16
17
from oemof import solph
18
from oemof import tools
19
from oemof.solph._models import LoggingError
20
21
22
def test_version_metadata():
23
    assert solph.__version__
24
25
26
def test_wrong_logging_level():
27
    datetimeindex = pd.date_range("1/1/2012", periods=12, freq="h")
28
    es = solph.EnergySystem(timeindex=datetimeindex, infer_last_interval=True)
29
    tools.logger.define_logging()
30
    my_logger = logging.getLogger()
31
    my_logger.setLevel("DEBUG")
32
    with pytest.raises(LoggingError, match="The root logger level is 'DEBUG'"):
33
        solph.Model(es)
34
    my_logger.setLevel("WARNING")
35