12345678910111213141516171819202122232425262728293031 |
- import os
- import pytest
- import sys
- from tempfile import mkstemp
-
- from pyheatpump import DB
- from pyheatpump.models import *
- from pyheatpump.config import config
-
- pytest_plugins = "pytester"
-
- @pytest.fixture(scope="module")
- def set_test_db():
- _, tmpdb = mkstemp(suffix='.db', dir=os.getcwd(), )
- print(f'Will store database in {tmpdb}')
- config['heatpump']['database'] = tmpdb
- assert DB.initialize(os.path.join(os.getcwd(), 'db/pyheatpump.sql'))
-
- DB.sqlf(os.path.join(os.getcwd(), 'db/test_variables.sql'))
-
- DB.sqlf(os.path.join(os.getcwd(), 'db/test_variable_values.sql'))
-
- DB.sqlf(os.path.join(os.getcwd(), 'db/test_variable_values_wo_time.sql'))
-
- yield
-
-
-
- @pytest.fixture
- def var_types():
- return VariableType.getall()
|