mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-09-13 07:21:16 +00:00
Update manual documentation for nested config.
* Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation.
This commit is contained in:
@@ -145,7 +145,7 @@ def config_eos(
|
||||
assert not config_file_cwd.exists()
|
||||
config_eos = get_config()
|
||||
config_eos.reset_settings()
|
||||
assert config_file == config_eos.config_file_path
|
||||
assert config_file == config_eos.general.config_file_path
|
||||
assert config_file.exists()
|
||||
assert not config_file_cwd.exists()
|
||||
assert config_default_dirs[-1] / "data" == config_eos.general.data_folder_path
|
||||
|
@@ -57,7 +57,7 @@ def test_computed_paths(config_eos):
|
||||
|
||||
def test_singleton_behavior(config_eos, config_default_dirs):
|
||||
"""Test that ConfigEOS behaves as a singleton."""
|
||||
initial_cfg_file = config_eos.config_file_path
|
||||
initial_cfg_file = config_eos.general.config_file_path
|
||||
with patch(
|
||||
"akkudoktoreos.config.config.user_config_dir", return_value=str(config_default_dirs[0])
|
||||
):
|
||||
@@ -65,7 +65,7 @@ def test_singleton_behavior(config_eos, config_default_dirs):
|
||||
instance2 = ConfigEOS()
|
||||
assert instance1 is config_eos
|
||||
assert instance1 is instance2
|
||||
assert instance1.config_file_path == initial_cfg_file
|
||||
assert instance1.general.config_file_path == initial_cfg_file
|
||||
|
||||
|
||||
def test_default_config_path(config_eos, config_default_dirs):
|
||||
@@ -86,13 +86,13 @@ def test_config_file_priority(config_default_dirs):
|
||||
config_file = Path(config_default_dir_cwd) / ConfigEOS.CONFIG_FILE_NAME
|
||||
config_file.write_text("{}")
|
||||
config_eos = get_config()
|
||||
assert config_eos.config_file_path == config_file
|
||||
assert config_eos.general.config_file_path == config_file
|
||||
|
||||
config_file = Path(config_default_dir_user) / ConfigEOS.CONFIG_FILE_NAME
|
||||
config_file.parent.mkdir()
|
||||
config_file.write_text("{}")
|
||||
config_eos.update()
|
||||
assert config_eos.config_file_path == config_file
|
||||
assert config_eos.general.config_file_path == config_file
|
||||
|
||||
|
||||
@patch("akkudoktoreos.config.config.user_config_dir")
|
||||
|
@@ -86,7 +86,7 @@ def test_config_md_current(config_eos):
|
||||
sys.path.insert(0, str(root_dir))
|
||||
from scripts import generate_config_md
|
||||
|
||||
config_md = generate_config_md.generate_config_md()
|
||||
config_md = generate_config_md.generate_config_md(config_eos)
|
||||
|
||||
with open(new_config_md_path, "w", encoding="utf8") as f_new:
|
||||
f_new.write(config_md)
|
||||
|
@@ -163,10 +163,14 @@ sample_config_data = {
|
||||
},
|
||||
"pvforecast": {
|
||||
"provider": "PVForecastAkkudoktor",
|
||||
"pvforecast0_peakpower": 5.0,
|
||||
"pvforecast0_surface_azimuth": 180,
|
||||
"pvforecast0_surface_tilt": 30,
|
||||
"pvforecast0_inverter_paco": 10000,
|
||||
"planes": [
|
||||
{
|
||||
"peakpower": 5.0,
|
||||
"surface_azimuth": 180,
|
||||
"surface_tilt": 30,
|
||||
"inverter_paco": 10000,
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user