From f7018e892d66c769664c98bb1898368af6c78003 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Sun, 11 Aug 2024 22:35:07 +0100 Subject: [PATCH] Allow not having a config file, otherwise pytest can't collect tests without it --- py/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/py/config.py b/py/config.py index 8adc7d6..9b7574d 100644 --- a/py/config.py +++ b/py/config.py @@ -116,9 +116,12 @@ def _load_from_file(file: str = _FILE) -> _Config: Load the state from a file Apply any required migrations """ - assert os.path.isfile(file) - loaded = files.load(file) - _migrate(loaded) + loaded = {} + if os.path.isfile(file): + loaded = files.load(file) + _migrate(loaded) + else: + logger.warn("No %s file found, bot cannot run!", file) return _Config(loaded)