11import os
2+ from pathlib import Path
23from esgvoc .core import service
34import esgvoc .api as ev
45
56
67def _ensure_default_dev_config_exists ():
7- """Ensure the 'default_dev' config exists for development testing."""
8+ """Ensure the 'default_dev' config exists for development testing and matches expected values ."""
89 default_dev_config = {
910 "projects" : [
1011 {
@@ -33,10 +34,16 @@ def _ensure_default_dev_config_exists():
3334 },
3435 }
3536
36- # Check if default_dev config exists
3737 existing_configs = service .config_manager .list_configs ()
3838 if "default_dev" not in existing_configs :
3939 service .config_manager .add_config ("default_dev" , default_dev_config )
40+ else :
41+ # Verify existing config matches expected values by reading the raw TOML file
42+ config_path = existing_configs ["default_dev" ]
43+ existing_config = service .config_manager ._load_toml (Path (config_path ))
44+ if existing_config != default_dev_config :
45+ service .config_manager .remove_config ("default_dev" )
46+ service .config_manager .add_config ("default_dev" , default_dev_config )
4047
4148
4249def _ensure_all_dev_config_exists ():
@@ -137,6 +144,7 @@ def test_install():
137144 # Verify the expected projects are present
138145 projects = ev .get_all_projects ()
139146 # default_dev and default have 2 projects, "all" has 7
147+ print (projects )
140148 if test_config in ["default_dev" , "default" ]:
141149 assert len (projects ) == 2
142150 assert "cmip6" in projects
@@ -156,4 +164,5 @@ def test_install():
156164 # Switch back to the selected test config for the rest of the tests
157165 # (The session fixture will restore the original config at the very end)
158166 service .config_manager .switch_config (test_config )
159- current_state = service .get_state ()
167+ current_state = service .get_state ()
168+
0 commit comments