fix: resolve the seven bugs pinned by the test audit
test / unit-tests (push) Successful in 14s
ci / docker (push) Successful in 23s
test / unit-tests (pull_request) Successful in 6s
test / komodo-deploy-script (push) Successful in 23s
test / komodo-deploy-script (pull_request) Successful in 16s

- read [ignored_tags] instead of [ignored_domains], so tag-based ignoring
  actually works
- match ignored tags as whole tags, not substrings ('ipt' no longer matches
  'iptorrents')
- send the login-error notification through the Pushover client instead of
  the non-existent module-level send_message()
- handle an empty torrent list instead of raising IndexError before any
  summary is sent
- tag a new torrent once instead of once per code path
- honour toml_path without DOCKER in AppriseClient
- close replaced log handlers so the file descriptor is released

Also add the missing [telemetry] section to config.toml.example, which
qbit-maid.py requires at startup.

The tests that pinned each bug now assert the fixed behaviour, and the
suite still reports 100% coverage.
This commit is contained in:
trex Bot committed 2026-11-03 16:10:19 -06:00
1 parent ab46ea1fb2
commit d8034278d8
10 files changed
+207 -92

No files matched your search

+22
View File
@@ -77,9 +77,30 @@ def tor_notify_summary(self):
except Exception as e: # never let a notification failure abort a run
logger.error(f"Failed to send pushover notification: {e}")
def tor_notify_error(self, error, title="qbit-maid API ERROR"):
"""Report an error through pushover when it is configured.
The vendored ``pushover`` module only exposes the ``Pushover`` class, so the
message has to go through the client built by :func:`tor_notify`.
"""
logger = _logger(self)
logger.error(f"{title}: {error}")
if not getattr(self, "use_pushover", False):
return
client = getattr(self, "poc", None)
if client is None:
return
try:
client.message(self.po_key, str(error), title=title)
except Exception as exc: # never let a notification failure abort a run
logger.error(f"Failed to send pushover error notification: {exc}")
def list_first_tor(self, index=0):
"""Only lists the first torrent"""
self.tl.debug('First torrent in the list:')
if not self.torrent_list:
self.tl.debug('No torrents found.')
return
torrent = self.torrent_list[index]
for k,v in torrent.items():
self.tl.debug(f'{k}: {v}')
@@ -337,6 +358,7 @@ def setup_logging(use_log: bool, log_path: str, log_level: str,
# Make setup idempotent: clear any handlers from a previous call
for handler in list(logger.handlers):
logger.removeHandler(handler)
handler.close()
if not use_log:
logger.addHandler(logging.NullHandler())