@@ -205,18 +205,23 @@ def test_notify_no_socket():
205205 assert notify ('FDSTORE=1' , pid = os .getpid ()) == False
206206 assert notify ('FDSTORE=1' , pid = os .getpid (), fds = (1 ,)) == False
207207
208+ if sys .version_info >= (3 ,):
209+ connection_error = ConnectionRefusedError
210+ else :
211+ connection_error = OSError
212+
208213def test_notify_bad_socket ():
209214 os .environ ['NOTIFY_SOCKET' ] = '/dev/null'
210215
211- with pytest .raises (ConnectionRefusedError ):
216+ with pytest .raises (connection_error ):
212217 notify ('READY=1' )
213- with pytest .raises (ConnectionRefusedError ):
218+ with pytest .raises (connection_error ):
214219 notify ('FDSTORE=1' , fds = [])
215- with pytest .raises (ConnectionRefusedError ):
220+ with pytest .raises (connection_error ):
216221 notify ('FDSTORE=1' , fds = [1 ,2 ])
217- with pytest .raises (ConnectionRefusedError ):
222+ with pytest .raises (connection_error ):
218223 notify ('FDSTORE=1' , pid = os .getpid ())
219- with pytest .raises (ConnectionRefusedError ):
224+ with pytest .raises (connection_error ):
220225 notify ('FDSTORE=1' , pid = os .getpid (), fds = (1 ,))
221226
222227def test_notify_with_socket (tmpdir ):
0 commit comments