Allow not having a config file, otherwise pytest can't collect tests without it
This commit is contained in:
parent
10ac46b773
commit
f7018e892d
1 changed files with 6 additions and 3 deletions
|
@ -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 = {}
|
||||||
loaded = files.load(file)
|
if os.path.isfile(file):
|
||||||
_migrate(loaded)
|
loaded = files.load(file)
|
||||||
|
_migrate(loaded)
|
||||||
|
else:
|
||||||
|
logger.warn("No %s file found, bot cannot run!", file)
|
||||||
return _Config(loaded)
|
return _Config(loaded)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue