Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
Signed-off-by: ahmedsobeh <[email protected]>
  • Loading branch information
ahmedsobeh committed Jul 3, 2024
1 parent 4480492 commit f7c3a93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/test_asyncio/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ def test_invalid_scheme_raises_error(self):
with pytest.raises(ValueError) as cm:
valkey.ConnectionPool.from_url("localhost")
assert str(cm.value) == (
"Valkey URL must specify one of the following schemes ['valkey', 'valkeys', 'redis', 'rediss']"
"Valkey URL must specify one of the following schemes"
" ['valkey', 'valkeys', 'redis', 'rediss']"
)


Expand Down
6 changes: 4 additions & 2 deletions tests/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,16 @@ def test_invalid_scheme_raises_error(self):
with pytest.raises(ValueError) as cm:
valkey.ConnectionPool.from_url("localhost")
assert str(cm.value) == (
"Valkey URL must specify one of the following schemes ['valkey', 'valkeys', 'redis', 'rediss']"
"Valkey URL must specify one of the following schemes "
"['valkey', 'valkeys', 'redis', 'rediss']"
)

def test_invalid_scheme_raises_error_when_double_slash_missing(self):
with pytest.raises(ValueError) as cm:
valkey.ConnectionPool.from_url("valkey:foo.bar.com:12345")
assert str(cm.value) == (
"Valkey URL must specify one of the following schemes ['valkey', 'valkeys', 'redis', 'rediss']"
"Valkey URL must specify one of the following schemes "
"['valkey', 'valkeys', 'redis', 'rediss']"
)


Expand Down
2 changes: 1 addition & 1 deletion valkey/_parsers/url_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def parse_url(url: str, async_connection: bool):
except (AttributeError, ValueError):
pass

if parsed.scheme in supported_schemes:
if parsed.scheme in ("valkeys", "rediss"):
kwargs["connection_class"] = (
SSLConnectionAsync if async_connection else SSLConnection
)
Expand Down

0 comments on commit f7c3a93

Please sign in to comment.