Slightly adjust backend for unittesting.
This commit is contained in:
parent
246152537e
commit
b5c027a01a
1 changed files with 4 additions and 3 deletions
|
@ -10,7 +10,7 @@ from apscheduler.triggers.cron import CronTrigger
|
||||||
# setup logging
|
# setup logging
|
||||||
chdir(str(getenv("HOME")) + "/.local/share/wallman/")
|
chdir(str(getenv("HOME")) + "/.local/share/wallman/")
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(filename="wallman.log", encoding="utf-8", level=logging.WARNING)
|
logging.basicConfig(filename="wallman.log", encoding="utf-8", level=logging.DEBUG)
|
||||||
|
|
||||||
# read config
|
# read config
|
||||||
# a = list(data["changing_times"].values())
|
# a = list(data["changing_times"].values())
|
||||||
|
@ -126,7 +126,7 @@ class ConfigValidity(_ConfigLib):
|
||||||
logger.critical(f"Dictionary {wallpaper_set} does not have sufficient entries, exciting...")
|
logger.critical(f"Dictionary {wallpaper_set} does not have sufficient entries, exciting...")
|
||||||
raise ConfigError(f"Dictionary {wallpaper_set} does not have the correct amount of entries, exciting...")
|
raise ConfigError(f"Dictionary {wallpaper_set} does not have the correct amount of entries, exciting...")
|
||||||
|
|
||||||
def validate_config(self) -> None:
|
def validate_config(self) -> bool:
|
||||||
if not self._check_fallback_wallpaper():
|
if not self._check_fallback_wallpaper():
|
||||||
pass
|
pass
|
||||||
if not self._check_wallpapers_per_set_and_changing_times():
|
if not self._check_wallpapers_per_set_and_changing_times():
|
||||||
|
@ -138,6 +138,7 @@ class ConfigValidity(_ConfigLib):
|
||||||
if not self._check_wallpaper_amount():
|
if not self._check_wallpaper_amount():
|
||||||
exit(1)
|
exit(1)
|
||||||
logger.debug("The config file has been validated successfully (No Errors)")
|
logger.debug("The config file has been validated successfully (No Errors)")
|
||||||
|
return True
|
||||||
|
|
||||||
class WallpaperLogic(_ConfigLib):
|
class WallpaperLogic(_ConfigLib):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -162,7 +163,7 @@ class WallpaperLogic(_ConfigLib):
|
||||||
else:
|
else:
|
||||||
return start <= x or x < end
|
return start <= x or x < end
|
||||||
|
|
||||||
def _check_system_exitcode(self, code) -> None:
|
def _check_system_exitcode(self, code) -> bool:
|
||||||
if code != 0:
|
if code != 0:
|
||||||
try:
|
try:
|
||||||
self.set_fallback_wallpaper()
|
self.set_fallback_wallpaper()
|
||||||
|
|
Loading…
Reference in a new issue