Skip to content

Commit

Permalink
refactor: ♻️ make client url private, but backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
iwpnd committed Nov 14, 2024
1 parent e72b441 commit 651f7b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pyle38/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ def __init__(
for option in default_options:
self.__client_options = option(self.__client_options)

@property
def url(self) -> str:
"""The client url
Returns:
str: returns the clients url
"""
return self.__url

def client_options(self) -> ClientOptions:
"""Get the current ClientOptions.
Expand Down
7 changes: 4 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

@pytest.mark.asyncio
async def test_client_options():
url = os.getenv("TILE38_LEADER_URI") or "redis://localhost:9851"
client_options = [
WithRetryExponentialBackoff(10),
WithRetryOnError(Pyle38TimeoutError, Pyle38ConnectionError),
]
client = Client(
os.getenv("TILE38_LEADER_URI") or "redis://localhost:9851", client_options
)
client = Client(url, client_options)

assert client.url == url

opts = client.client_options()
assert opts["retry"]
Expand Down

0 comments on commit 651f7b3

Please sign in to comment.