Skip to content

Commit bd7a28d

Browse files
committed
fix typo in connection error handling
1 parent 2fe55af commit bd7a28d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

clamd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def _error_message(self, exception):
306306
msg=exception.args[0]
307307
)
308308
else:
309-
return "Error {erno} connecting {host}:{port}. {msg}.".format(
309+
return "Error {erno} connecting {path}. {msg}.".format(
310310
erno=exception.args[0],
311311
path=self.unix_socket,
312312
msg=exception.args[1]

tests/test_api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import stat
1111

12-
from nose.tools import ok_, eq_, assert_true
12+
from nose.tools import ok_, eq_, assert_true, raises
1313

1414
mine = (stat.S_IREAD | stat.S_IWRITE)
1515
other = stat.S_IROTH
@@ -89,6 +89,13 @@ def __init__(self):
8989
self.kwargs = {"timeout": 10}
9090

9191

92+
@raises(clamd.ConnectionError)
93+
def test_cannot_connect():
94+
clamd.ClamdUnixSocket(filename="/tmp/404").ping()
95+
96+
97+
98+
9299
# class TestNetworkSocket(TestUnixSocket):
93100
# def setup(self):
94101
# self.cd = clamd.ClamdNetworkSocket()

0 commit comments

Comments
 (0)