Skip to content

Commit 12e5055

Browse files
committed
Applying review comments
1 parent 2d7ac28 commit 12e5055

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

tests/test_asyncio/test_connection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,10 @@ async def test_format_error_message(conn, error, expected_message):
532532

533533

534534
async def test_network_connection_failure():
535-
with pytest.raises(ConnectionError) as e:
535+
exp_err = fr"^Error {ECONNREFUSED} connecting to 127.0.0.1:9999.(.+)$"
536+
with pytest.raises(ConnectionError, match=exp_err):
536537
redis = Redis(host="127.0.0.1", port=9999)
537538
await redis.set("a", "b")
538-
expected_err = f"Error {ECONNREFUSED} connecting to 127.0.0.1:9999. Connect"
539-
assert str(e.value).startswith(expected_err)
540539

541540

542541
async def test_unix_socket_connection_failure():

tests/test_connection.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,11 @@ def test_format_error_message(conn, error, expected_message):
350350

351351

352352
def test_network_connection_failure():
353-
with pytest.raises(ConnectionError) as e:
353+
exp_err = f"Error {ECONNREFUSED} connecting to localhost:9999. Connection refused."
354+
with pytest.raises(ConnectionError, match=exp_err):
354355
redis = Redis(port=9999)
355356
redis.set("a", "b")
356357

357-
assert (
358-
str(e.value)
359-
== f"Error {ECONNREFUSED} connecting to localhost:9999. Connection refused."
360-
)
361-
362358

363359
def test_unix_socket_connection_failure():
364360
with pytest.raises(ConnectionError) as e:

0 commit comments

Comments
 (0)