Files

51 lines
1.4 KiB
Python

"""
Tests for config.Config singleton and edge cases.
Covers: singleton behavior, config file merging, missing file handling.
"""
import os
import pytest
from logger import Logger
class TestConfig:
def setup_method(self):
Logger.init()
Logger.remove_file_logger()
# Reset singleton so each test gets a fresh config
import config
if hasattr(config, '_instance'):
config._instance = None
def test_config_is_singleton(self):
from config import Config
c1 = Config()
c2 = Config()
assert c1 is c2
def test_config_loads_difficulty(self):
from config import Config
c = Config()
assert "difficulty" in c.general
def test_config_loads_char_type(self):
from config import Config
c = Config()
assert "type" in c.char
def test_config_loads_routes(self):
from config import Config
c = Config()
assert hasattr(c, 'routes')
def test_config_general_has_max_game_length(self):
from config import Config
c = Config()
assert "max_game_length_s" in c.general
def test_config_char_has_keybinds(self):
from config import Config
c = Config()
# hammerdin config should have stand_still and show_items
assert "stand_still" in c.char
assert "show_items" in c.char