Skip to content

Commit

Permalink
Merge pull request #381 from mraniki/dev
Browse files Browse the repository at this point in the history
⬆️ 🤖 - Repartee is something we think of twentyfour hours too late
  • Loading branch information
mraniki committed Jul 8, 2024
2 parents a8b8a4d + 02b716f commit 62bf556
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
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"
# )

0 comments on commit 62bf556

Please sign in to comment.