From 34b2fcfeaf353c0bef6e3561e89f7e1034f1f201 Mon Sep 17 00:00:00 2001 From: Andy Morrell Date: Fri, 30 Oct 2026 19:54:28 +0000 Subject: [PATCH 1/6] feat(docker): add THEMERR_SCAN_ON_BOOT to skip the startup scan Themerr runs every scheduled job once when it starts, including the full theme scan. Setting THEMERR_SCAN_ON_BOOT=false (or 0/no/off) skips only that startup scan; the dashboard refresh still runs and scheduled scans continue at the configured interval. Unset keeps the current behaviour. --- DOCKER_README.md | 2 + src/themerr/scheduled_tasks.py | 41 +++++++++++++++++++- tests/unit/themerr/test_scheduled_tasks.py | 45 ++++++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/DOCKER_README.md b/DOCKER_README.md index bba4511a..88a73a8d 100644 --- a/DOCKER_README.md +++ b/DOCKER_README.md @@ -65,6 +65,7 @@ services: - PUID= - PGID= - TZ= + - THEMERR_SCAN_ON_BOOT=true ports: - 9494:9494 - 9495:9495 @@ -105,6 +106,7 @@ The internal port is `9494`; the host port may be changed (e.g. `-p 8080:9494`). | `-e PUID=` | User ID | `1001` | False | | `-e PGID=` | Group ID | `1001` | False | | `-e TZ=` | Lookup TZ value [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `America/New_York` | True | +| `-e THEMERR_SCAN_ON_BOOT=` | Set to `false` to skip the theme scan at startup; scheduled scans still run | `false` | False | ### User / Group Identifiers: diff --git a/src/themerr/scheduled_tasks.py b/src/themerr/scheduled_tasks.py index 1e0971ca..0ea6da43 100644 --- a/src/themerr/scheduled_tasks.py +++ b/src/themerr/scheduled_tasks.py @@ -1,6 +1,7 @@ # standard imports from collections import deque from datetime import datetime, timezone +import os import threading import time import uuid @@ -20,6 +21,14 @@ _job_lock = threading.RLock() _jobs = deque(maxlen=30) _running = {} +SCAN_ON_BOOT_ENV = 'THEMERR_SCAN_ON_BOOT' +_SCAN_TAG = 'theme-scan' +_DISABLED_VALUES = { + '0', + 'false', + 'no', + 'off', +} def run_threaded( @@ -96,6 +105,27 @@ def run_job() -> None: return job_thread +def scan_on_boot() -> bool: + """ + Check whether the theme scan should run when the scheduler starts. + + The ``THEMERR_SCAN_ON_BOOT`` environment variable disables the startup scan when set to + ``false``, ``0``, ``no``, or ``off``. Any other value, or no value, keeps the scan. + Scheduled scans still run at the configured interval. + + Returns + ------- + bool + True when the startup theme scan should run. + + Examples + -------- + >>> scan_on_boot() + True + """ + return os.environ.get(SCAN_ON_BOOT_ENV, '').strip().lower() not in _DISABLED_VALUES + + def schedule_loop() -> None: """ Start the schedule loop. @@ -108,7 +138,14 @@ def schedule_loop() -> None: ... """ log.info('Scheduler started; dispatching initial jobs') - schedule.run_all() # run all jobs once + if scan_on_boot(): + schedule.run_all() # run all jobs once + else: + log.info('Skipping the startup theme scan because %s is disabled', SCAN_ON_BOOT_ENV) + skipped = schedule.get_jobs(_SCAN_TAG) + for job in schedule.jobs[:]: + if job not in skipped: + job.run() while True: schedule.run_pending() @@ -124,7 +161,7 @@ def configure_jobs() -> None: target=scheduled_update, daemon=True, task_name='Theme scan and queue', - ).tag('themerr') + ).tag('themerr', _SCAN_TAG) schedule.every(max(15, int(config.CONFIG['Themerr']['INT_UPDATE_DATABASE_CACHE_INTERVAL']))).minutes.do( job_func=run_threaded, diff --git a/tests/unit/themerr/test_scheduled_tasks.py b/tests/unit/themerr/test_scheduled_tasks.py index 71643845..69dfec41 100644 --- a/tests/unit/themerr/test_scheduled_tasks.py +++ b/tests/unit/themerr/test_scheduled_tasks.py @@ -4,6 +4,9 @@ from threading import Event from unittest.mock import Mock +# lib imports +import pytest + # local imports from themerr import scheduled_tasks @@ -127,3 +130,45 @@ def test_reconfigure_changes_intervals_without_duplicating_or_removing_other_job assert scheduler.get_jobs('other') == [unrelated] finally: scheduler.clear() + + +@pytest.mark.parametrize(('value', 'expected'), [ + (None, True), + ('', True), + ('true', True), + ('1', True), + ('false', False), + (' FALSE ', False), + ('0', False), + ('no', False), + ('off', False), +]) +def test_scan_on_boot_reads_the_environment(monkeypatch, value, expected): + if value is None: + monkeypatch.delenv(scheduled_tasks.SCAN_ON_BOOT_ENV, raising=False) + else: + monkeypatch.setenv(scheduled_tasks.SCAN_ON_BOOT_ENV, value) + assert scheduled_tasks.scan_on_boot() is expected + + +def test_schedule_loop_skips_only_the_startup_scan_when_disabled(configured, monkeypatch): + scheduler = scheduled_tasks.schedule + scheduler.clear() + dispatched = [] + monkeypatch.setattr(scheduled_tasks, 'run_threaded', lambda **kwargs: dispatched.append(kwargs['task_name'])) + monkeypatch.setenv(scheduled_tasks.SCAN_ON_BOOT_ENV, 'false') + + def stop(seconds): + raise RuntimeError('stop') + + monkeypatch.setattr(scheduled_tasks.time, 'sleep', stop) + try: + configured['Themerr']['BOOL_THEMERR_ENABLED'] = True + scheduled_tasks.configure_jobs() + with pytest.raises(RuntimeError): + scheduled_tasks.schedule_loop() + assert 'Theme scan and queue' not in dispatched + assert 'Dashboard refresh' in dispatched + assert len(scheduler.get_jobs('theme-scan')) == 1 + finally: + scheduler.clear() From 3cc471f797ff3192ce7935a316843719e64bfba6 Mon Sep 17 00:00:00 2001 From: Andy Morrell Date: Fri, 30 Oct 2026 21:14:49 +0000 Subject: [PATCH 2/6] refactor: make startup scanning a Themerr setting Replace the THEMERR_SCAN_ON_BOOT environment variable with the BOOL_SCAN_ON_BOOT setting (default on), so it appears on the Settings page and persists in config.ini. The scheduler reads it at startup. --- DOCKER_README.md | 5 +- locale/themerr.po | 80 ++++++++++++---------- src/common/config.py | 7 ++ src/themerr/scheduled_tasks.py | 18 ++--- tests/unit/themerr/test_scheduled_tasks.py | 38 +++++----- 5 files changed, 78 insertions(+), 70 deletions(-) diff --git a/DOCKER_README.md b/DOCKER_README.md index 88a73a8d..07694e38 100644 --- a/DOCKER_README.md +++ b/DOCKER_README.md @@ -65,7 +65,6 @@ services: - PUID= - PGID= - TZ= - - THEMERR_SCAN_ON_BOOT=true ports: - 9494:9494 - 9495:9495 @@ -106,7 +105,9 @@ The internal port is `9494`; the host port may be changed (e.g. `-p 8080:9494`). | `-e PUID=` | User ID | `1001` | False | | `-e PGID=` | Group ID | `1001` | False | | `-e TZ=` | Lookup TZ value [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `America/New_York` | True | -| `-e THEMERR_SCAN_ON_BOOT=` | Set to `false` to skip the theme scan at startup; scheduled scans still run | `false` | False | + +To skip the theme scan when the container starts, turn off **Scan on startup** under **Settings → Themerr**. +Scheduled scans still run, and the change applies the next time the container starts. ### User / Group Identifiers: diff --git a/locale/themerr.po b/locale/themerr.po index 3e318445..ff2a92df 100644 --- a/locale/themerr.po +++ b/locale/themerr.po @@ -210,7 +210,7 @@ msgid "" "Servers page." msgstr "" -#: src/common/config.py:260 src/common/config.py:361 +#: src/common/config.py:260 src/common/config.py:368 msgid "Movie support" msgstr "" @@ -218,7 +218,7 @@ msgstr "" msgid "Add themes to Jellyfin movies." msgstr "" -#: src/common/config.py:264 src/common/config.py:367 +#: src/common/config.py:264 src/common/config.py:374 msgid "Series support" msgstr "" @@ -226,7 +226,7 @@ msgstr "" msgid "Add themes to Jellyfin series." msgstr "" -#: src/common/config.py:268 src/common/config.py:355 web/templates/home.html:31 +#: src/common/config.py:268 src/common/config.py:362 web/templates/home.html:31 msgid "Collections" msgstr "" @@ -359,144 +359,154 @@ msgid "Themerr settings." msgstr "" #: src/common/config.py:349 -msgid "Themerr Enabled" +msgid "Scan on startup" msgstr "" #: src/common/config.py:350 -msgid "When enabled, Themerr will attempt to update themes." +msgid "" +"Run the theme scan when Themerr starts. Scheduled scans still run when " +"this is disabled. Changes apply the next time Themerr starts." msgstr "" #: src/common/config.py:356 +msgid "Themerr Enabled" +msgstr "" + +#: src/common/config.py:357 +msgid "When enabled, Themerr will attempt to update themes." +msgstr "" + +#: src/common/config.py:363 msgid "Add themes to collections." msgstr "" -#: src/common/config.py:362 +#: src/common/config.py:369 msgid "Add themes to movies using the Plex Movie agent." msgstr "" -#: src/common/config.py:368 +#: src/common/config.py:375 msgid "Add themes to series using the Plex Series agent." msgstr "" -#: src/common/config.py:373 +#: src/common/config.py:380 msgid "Overwrite Plex themes" msgstr "" -#: src/common/config.py:374 +#: src/common/config.py:381 msgid "When enabled, Themerr will overwrite themes provided by Plex." msgstr "" -#: src/common/config.py:379 +#: src/common/config.py:386 msgid "Prefer MP4A AAC Codec" msgstr "" -#: src/common/config.py:380 +#: src/common/config.py:387 msgid "This can improve theme compatibility with Apple devices." msgstr "" -#: src/common/config.py:385 +#: src/common/config.py:392 msgid "Remove unused themes" msgstr "" -#: src/common/config.py:386 +#: src/common/config.py:393 msgid "" "Frees up space in your Plex metadata directory. This option requires that" " the \"Plex data directory\" path is set" msgstr "" -#: src/common/config.py:392 +#: src/common/config.py:399 msgid "Remove unused art" msgstr "" -#: src/common/config.py:393 src/common/config.py:401 +#: src/common/config.py:400 src/common/config.py:408 msgid "" "Applies to collection. Frees up space in your Plex metadata directory. " "This option requires that the \"Plex data directory\" path is set" msgstr "" -#: src/common/config.py:400 +#: src/common/config.py:407 msgid "Remove unused posters" msgstr "" -#: src/common/config.py:408 +#: src/common/config.py:415 msgid "Collection metadata" msgstr "" -#: src/common/config.py:409 +#: src/common/config.py:416 msgid "" "Update collection metadata (poster, art, and summary) during scheduled " "update." msgstr "" -#: src/common/config.py:414 +#: src/common/config.py:421 msgid "Ignore locked fields." msgstr "" -#: src/common/config.py:415 +#: src/common/config.py:422 msgid "" "If you used Themerr v2024.813.13709 or lower, you may need to enable this" " to update items." msgstr "" -#: src/common/config.py:421 +#: src/common/config.py:428 msgid "Ignored library IDs" msgstr "" -#: src/common/config.py:422 +#: src/common/config.py:429 msgid "" "Comma-separated library IDs to exclude from scheduled updates. IDs appear" " on Home." msgstr "" -#: src/common/config.py:428 +#: src/common/config.py:435 msgid "Update themes interval" msgstr "" -#: src/common/config.py:429 +#: src/common/config.py:436 msgid "Interval for automatic update task, in minutes (min: 15)." msgstr "" -#: src/common/config.py:436 +#: src/common/config.py:443 msgid "Update database cache interval" msgstr "" -#: src/common/config.py:437 +#: src/common/config.py:444 msgid "Interval for database cache update task, in minutes (min: 15)." msgstr "" -#: src/common/config.py:444 +#: src/common/config.py:451 msgid "PlexAPI timeout" msgstr "" -#: src/common/config.py:445 +#: src/common/config.py:452 msgid "" "Increase this slightly if you experience timeouts when adding themes. " "(min: 1)" msgstr "" -#: src/common/config.py:452 +#: src/common/config.py:459 msgid "Theme upload retries" msgstr "" -#: src/common/config.py:453 +#: src/common/config.py:460 msgid "If uploading themes fail, retry this many times. (min: 0)" msgstr "" -#: src/common/config.py:460 +#: src/common/config.py:467 msgid "Multiprocessing thread count" msgstr "" -#: src/common/config.py:461 +#: src/common/config.py:468 msgid "" "The number of threads to use when adding themes. Restart required. (min: " "1)" msgstr "" -#: src/common/config.py:469 +#: src/common/config.py:476 msgid "YouTube Cookies" msgstr "" -#: src/common/config.py:471 +#: src/common/config.py:478 msgid "" "Optional: export youtube.com cookies with Get cookies.txt LOCALLY using " "its JSON format, then paste the entire JSON array here and save. Saved " @@ -505,7 +515,7 @@ msgid "" "them." msgstr "" -#: src/common/config.py:478 +#: src/common/config.py:485 msgid "Cookie export instructions" msgstr "" diff --git a/src/common/config.py b/src/common/config.py index a2ee2f1e..467a44ba 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -344,6 +344,13 @@ def on_change_plex_url() -> None: 'name': _('Themerr'), 'description': _('Themerr settings.'), 'icon': 'music', + 'BOOL_SCAN_ON_BOOT': { + 'type': 'boolean', + 'name': _('Scan on startup'), + 'description': _('Run the theme scan when Themerr starts. Scheduled scans still run when this is ' + 'disabled. Changes apply the next time Themerr starts.'), + 'default': True, + }, 'BOOL_THEMERR_ENABLED': { 'type': 'boolean', 'name': _('Themerr Enabled'), diff --git a/src/themerr/scheduled_tasks.py b/src/themerr/scheduled_tasks.py index 0ea6da43..40b5def0 100644 --- a/src/themerr/scheduled_tasks.py +++ b/src/themerr/scheduled_tasks.py @@ -1,7 +1,6 @@ # standard imports from collections import deque from datetime import datetime, timezone -import os import threading import time import uuid @@ -21,14 +20,7 @@ _job_lock = threading.RLock() _jobs = deque(maxlen=30) _running = {} -SCAN_ON_BOOT_ENV = 'THEMERR_SCAN_ON_BOOT' _SCAN_TAG = 'theme-scan' -_DISABLED_VALUES = { - '0', - 'false', - 'no', - 'off', -} def run_threaded( @@ -109,9 +101,9 @@ def scan_on_boot() -> bool: """ Check whether the theme scan should run when the scheduler starts. - The ``THEMERR_SCAN_ON_BOOT`` environment variable disables the startup scan when set to - ``false``, ``0``, ``no``, or ``off``. Any other value, or no value, keeps the scan. - Scheduled scans still run at the configured interval. + Reads the ``BOOL_SCAN_ON_BOOT`` Themerr setting. The scheduler reads it once at startup, + so a change applies the next time Themerr starts. Scheduled scans still run at the + configured interval when the startup scan is disabled. Returns ------- @@ -123,7 +115,7 @@ def scan_on_boot() -> bool: >>> scan_on_boot() True """ - return os.environ.get(SCAN_ON_BOOT_ENV, '').strip().lower() not in _DISABLED_VALUES + return config.CONFIG['Themerr']['BOOL_SCAN_ON_BOOT'] def schedule_loop() -> None: @@ -141,7 +133,7 @@ def schedule_loop() -> None: if scan_on_boot(): schedule.run_all() # run all jobs once else: - log.info('Skipping the startup theme scan because %s is disabled', SCAN_ON_BOOT_ENV) + log.info('Skipping the startup theme scan because Scan on startup is disabled') skipped = schedule.get_jobs(_SCAN_TAG) for job in schedule.jobs[:]: if job not in skipped: diff --git a/tests/unit/themerr/test_scheduled_tasks.py b/tests/unit/themerr/test_scheduled_tasks.py index 69dfec41..0982a8e5 100644 --- a/tests/unit/themerr/test_scheduled_tasks.py +++ b/tests/unit/themerr/test_scheduled_tasks.py @@ -42,7 +42,7 @@ def test_scheduled_task_failure_is_logged_and_thread_exits(monkeypatch): assert error.call_args.args[:2] == ('Scheduled task failed: %s (%.1f seconds)', 'Theme scan and queue') -def test_schedule_loop(monkeypatch): +def test_schedule_loop(configured, monkeypatch): run_all = Mock() pending = Mock() @@ -132,23 +132,19 @@ def test_reconfigure_changes_intervals_without_duplicating_or_removing_other_job scheduler.clear() -@pytest.mark.parametrize(('value', 'expected'), [ - (None, True), - ('', True), - ('true', True), - ('1', True), - ('false', False), - (' FALSE ', False), - ('0', False), - ('no', False), - ('off', False), -]) -def test_scan_on_boot_reads_the_environment(monkeypatch, value, expected): - if value is None: - monkeypatch.delenv(scheduled_tasks.SCAN_ON_BOOT_ENV, raising=False) - else: - monkeypatch.setenv(scheduled_tasks.SCAN_ON_BOOT_ENV, value) - assert scheduled_tasks.scan_on_boot() is expected +def test_scan_on_boot_defaults_to_enabled(configured): + assert configured['Themerr']['BOOL_SCAN_ON_BOOT'] is True + assert scheduled_tasks.scan_on_boot() is True + + +def test_disabled_scan_on_boot_survives_a_config_reload(configured, monkeypatch): + from common import config + configured['Themerr']['BOOL_SCAN_ON_BOOT'] = False + assert config.save_config(configured) + reloaded = config.create_config(configured.filename) + assert reloaded['Themerr']['BOOL_SCAN_ON_BOOT'] is False + monkeypatch.setattr(config, 'CONFIG', reloaded) + assert scheduled_tasks.scan_on_boot() is False def test_schedule_loop_skips_only_the_startup_scan_when_disabled(configured, monkeypatch): @@ -156,7 +152,6 @@ def test_schedule_loop_skips_only_the_startup_scan_when_disabled(configured, mon scheduler.clear() dispatched = [] monkeypatch.setattr(scheduled_tasks, 'run_threaded', lambda **kwargs: dispatched.append(kwargs['task_name'])) - monkeypatch.setenv(scheduled_tasks.SCAN_ON_BOOT_ENV, 'false') def stop(seconds): raise RuntimeError('stop') @@ -164,11 +159,14 @@ def stop(seconds): monkeypatch.setattr(scheduled_tasks.time, 'sleep', stop) try: configured['Themerr']['BOOL_THEMERR_ENABLED'] = True + configured['Themerr']['BOOL_SCAN_ON_BOOT'] = False scheduled_tasks.configure_jobs() with pytest.raises(RuntimeError): scheduled_tasks.schedule_loop() assert 'Theme scan and queue' not in dispatched assert 'Dashboard refresh' in dispatched - assert len(scheduler.get_jobs('theme-scan')) == 1 + scan_jobs = scheduler.get_jobs('theme-scan') + assert len(scan_jobs) == 1 + assert scan_jobs[0].next_run is not None finally: scheduler.clear() From 8aaefd8d444611debf9cb2be7c24566e90a9c179 Mon Sep 17 00:00:00 2001 From: LuckyNoS7evin <30657709+LuckyNoS7evin@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:33:10 +0000 Subject: [PATCH 3/6] Update DOCKER_README.md Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com> --- DOCKER_README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/DOCKER_README.md b/DOCKER_README.md index 07694e38..bba4511a 100644 --- a/DOCKER_README.md +++ b/DOCKER_README.md @@ -106,9 +106,6 @@ The internal port is `9494`; the host port may be changed (e.g. `-p 8080:9494`). | `-e PGID=` | Group ID | `1001` | False | | `-e TZ=` | Lookup TZ value [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `America/New_York` | True | -To skip the theme scan when the container starts, turn off **Scan on startup** under **Settings → Themerr**. -Scheduled scans still run, and the change applies the next time the container starts. - ### User / Group Identifiers: When using data volumes (-v flags) permissions issues can arise between the host OS and the container. To avoid this From ad8e418e486e4360c44683f5d375f58b23c66f42 Mon Sep 17 00:00:00 2001 From: LuckyNoS7evin <30657709+LuckyNoS7evin@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:49:31 +0000 Subject: [PATCH 4/6] Apply suggestion from @ReenigneArcher Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com> --- src/themerr/scheduled_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/themerr/scheduled_tasks.py b/src/themerr/scheduled_tasks.py index 40b5def0..c3ad3c15 100644 --- a/src/themerr/scheduled_tasks.py +++ b/src/themerr/scheduled_tasks.py @@ -130,7 +130,7 @@ def schedule_loop() -> None: ... """ log.info('Scheduler started; dispatching initial jobs') - if scan_on_boot(): + if config.CONFIG['Themerr']['BOOL_SCAN_ON_BOOT']: schedule.run_all() # run all jobs once else: log.info('Skipping the startup theme scan because Scan on startup is disabled') From 6ea9eeaa606548a015f4a57bf03c45f6a5158b0c Mon Sep 17 00:00:00 2001 From: LuckyNoS7evin <30657709+LuckyNoS7evin@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:50:09 +0000 Subject: [PATCH 5/6] Remove scan_on_boot function from scheduled_tasks.py Removed the scan_on_boot function that checks if the theme scan should run on startup. --- src/themerr/scheduled_tasks.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/themerr/scheduled_tasks.py b/src/themerr/scheduled_tasks.py index c3ad3c15..0f763aaa 100644 --- a/src/themerr/scheduled_tasks.py +++ b/src/themerr/scheduled_tasks.py @@ -97,27 +97,6 @@ def run_job() -> None: return job_thread -def scan_on_boot() -> bool: - """ - Check whether the theme scan should run when the scheduler starts. - - Reads the ``BOOL_SCAN_ON_BOOT`` Themerr setting. The scheduler reads it once at startup, - so a change applies the next time Themerr starts. Scheduled scans still run at the - configured interval when the startup scan is disabled. - - Returns - ------- - bool - True when the startup theme scan should run. - - Examples - -------- - >>> scan_on_boot() - True - """ - return config.CONFIG['Themerr']['BOOL_SCAN_ON_BOOT'] - - def schedule_loop() -> None: """ Start the schedule loop. From 3198a020fc9c1c0899c60bed177aa8c1697ea461 Mon Sep 17 00:00:00 2001 From: LuckyNoS7evin <30657709+LuckyNoS7evin@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:10:47 +0000 Subject: [PATCH 6/6] Update tests/unit/themerr/test_scheduled_tasks.py oh fudge sake, that will teach me to use github suggestions Co-authored-by: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com> --- tests/unit/themerr/test_scheduled_tasks.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/unit/themerr/test_scheduled_tasks.py b/tests/unit/themerr/test_scheduled_tasks.py index 0982a8e5..c590c719 100644 --- a/tests/unit/themerr/test_scheduled_tasks.py +++ b/tests/unit/themerr/test_scheduled_tasks.py @@ -134,17 +134,14 @@ def test_reconfigure_changes_intervals_without_duplicating_or_removing_other_job def test_scan_on_boot_defaults_to_enabled(configured): assert configured['Themerr']['BOOL_SCAN_ON_BOOT'] is True - assert scheduled_tasks.scan_on_boot() is True -def test_disabled_scan_on_boot_survives_a_config_reload(configured, monkeypatch): +def test_disabled_scan_on_boot_survives_a_config_reload(configured): from common import config configured['Themerr']['BOOL_SCAN_ON_BOOT'] = False assert config.save_config(configured) reloaded = config.create_config(configured.filename) assert reloaded['Themerr']['BOOL_SCAN_ON_BOOT'] is False - monkeypatch.setattr(config, 'CONFIG', reloaded) - assert scheduled_tasks.scan_on_boot() is False def test_schedule_loop_skips_only_the_startup_scan_when_disabled(configured, monkeypatch):