Allow not having a config file, otherwise pytest can't collect tests without it

This commit is contained in:
Marc Di Luzio 2024-08-11 22:35:07 +01:00
parent 10ac46b773
commit f7018e892d

View file

@ -116,9 +116,12 @@ def _load_from_file(file: str = _FILE) -> _Config:
Load the state from a file Load the state from a file
Apply any required migrations Apply any required migrations
""" """
assert os.path.isfile(file) loaded = {}
if os.path.isfile(file):
loaded = files.load(file) loaded = files.load(file)
_migrate(loaded) _migrate(loaded)
else:
logger.warn("No %s file found, bot cannot run!", file)
return _Config(loaded) return _Config(loaded)