Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add selftest method to Factory #1831

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
!/plextraktsync/plex/*.py
!/plextraktsync/queue/*.py
!/plextraktsync/rich/*.py
!/plextraktsync/sync/*.py
!/plextraktsync/trakt/*.py
!/plextraktsync/util/*.py
!/plextraktsync/watch/*.py
Expand Down
3 changes: 3 additions & 0 deletions plextraktsync/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ def info(print=factory.print):
print(f"Enabled {len(sections.keys())} libraries in Plex Server:")
for id, section in sorted(sections.items()):
print(f" - {id}: {section.title_link}")

# load every method from factory
factory.selftest()
13 changes: 13 additions & 0 deletions plextraktsync/util/Factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@


class Factory:
def selftest(self):
fail = 0
# load every method from factory
for m in dir(self):
try:
getattr(self, m)
except Exception as e:
print(e)
fail += 1

if fail:
raise RuntimeError(f"Unpexpected {fail} methods failing")

def invalidate(self, keys: list[str] = None):
"""
Invalidate set of cached properties
Expand Down
Loading