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

⬆️ 🤖 - Repartee is something we think of twentyfour hours too late #381

Merged
merged 4 commits into from
Jul 8, 2024
Merged
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
13 changes: 10 additions & 3 deletions findmyorder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
return
self.client_classes = self.get_all_client_classes()
self.clients = []
# Create a client for each client in settings
# Create a client for each client in settings.findmyorder
for name, client_config in settings.findmyorder.items():
if (
# Skip empty client configs
Expand All @@ -65,7 +65,7 @@ def __init__(
continue

# Create the client
logger.debug("Creating FMO parser {}", name)
logger.debug("Creating client {}", name)
client = self._create_client(**client_config, name=name)
# If the client has a valid client attribute, append it to the list
if client and getattr(client, "client", None):
Expand Down Expand Up @@ -111,7 +111,14 @@ def _create_client(self, **kwargs):
library is not supported.

"""
library = kwargs.get("parser_library", "standard")
# library = kwargs.get("parser_library", "standard")
library = (
kwargs.get("library")
or kwargs.get("platform")
or kwargs.get("protocol")
or kwargs.get("parser_library")
or "standard"
)
cls = self.client_classes.get((f"{library.capitalize()}Handler"))
return None if cls is None else cls(**kwargs)

Expand Down
11 changes: 0 additions & 11 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,3 @@ async def test_standard_get_order(fmo, order, result_order):
assert result["comment"] == result_order["comment"]
assert type(result["timestamp"] is datetime)


# @pytest.mark.asyncio
# async def test_create_client_exception(fmo, caplog):
# result = fmo.create_client()
# assert result is not None
# assert any(
# record.message
# == "No Client were created. Check your settings or disable the module."
# for record in caplog.records
# if record.levelname == "WARNING"
# )
Loading