File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -782,8 +782,8 @@ def _update_config_file(self) -> None:
782782 "gamelist" : {
783783 "export" : self .config .GAMELIST_AUTO_EXPORT_ON_SCAN ,
784784 "media" : {
785- "thumbnail" : self .config .GAMELIST_MEDIA_THUMBNAIL ,
786- "image" : self .config .GAMELIST_MEDIA_IMAGE ,
785+ "thumbnail" : str ( self .config .GAMELIST_MEDIA_THUMBNAIL ) ,
786+ "image" : str ( self .config .GAMELIST_MEDIA_IMAGE ) ,
787787 },
788788 },
789789 "pegasus" : {
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from config .config_manager import ConfigManager
4+ from config .config_manager import config_manager as cm
5+
6+
7+ @pytest .fixture (autouse = True )
8+ def restore_config_manager_singleton ():
9+ """``ConfigManager`` is a process-wide singleton (``__new__`` returns the
10+ shared instance). Tests in this module point it at temporary config files
11+ and mutate it (e.g. ``add_platform_binding``), which would otherwise leak
12+ that state into other test modules through the global ``config_manager``.
13+
14+ Re-initialize the singleton from its original config file after each test
15+ so the global instance returns to its default state.
16+ """
17+ original_config_file = cm .config_file
18+ yield
19+ ConfigManager (original_config_file )
Original file line number Diff line number Diff line change @@ -160,3 +160,24 @@ def test_malformed_yaml_falls_back_to_defaults():
160160 assert loader .config .ROMS_FOLDER_NAME == "roms"
161161 assert loader .config .FIRMWARE_FOLDER_NAME == "bios"
162162 assert loader .config .SCAN_MEDIA == ["box2d" , "screenshot" , "manual" ]
163+
164+
165+ def test_config_updates_serialize_gamelist_media_as_plain_strings (tmp_path ):
166+ config_file = tmp_path / "config.yml"
167+ config_file .write_text (
168+ "scan:\n "
169+ " gamelist:\n "
170+ " media:\n "
171+ " thumbnail: box2d\n "
172+ " image: screenshot\n "
173+ )
174+ loader = ConfigManager (str (config_file ))
175+ loader .add_platform_binding ("atarist" , "atari-st" )
176+
177+ config_text = config_file .read_text ()
178+ assert "!!python/object" not in config_text
179+ assert "thumbnail: box2d" in config_text
180+ assert "image: screenshot" in config_text
181+
182+ reloaded = ConfigManager (str (config_file ))
183+ assert reloaded .config .PLATFORMS_BINDING == {"atarist" : "atari-st" }
You can’t perform that action at this time.
0 commit comments