File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 33import posix
44import socket
55import contextlib
6+ import errno
67from systemd .daemon import (booted ,
78 is_fifo , _is_fifo ,
89 is_socket , _is_socket ,
@@ -89,20 +90,36 @@ def test_is_fifo_bad_fd(tmpdir):
8990 with pytest .raises (OSError ):
9091 assert not is_fifo (- 1 , path )
9192
93+ def is_mq_wrapper (arg ):
94+ try :
95+ return is_mq (arg )
96+ except OSError as error :
97+ # systemd < 227 compatiblity
98+ assert error .errno == errno .EBADF
99+ return False
100+
101+ def _is_mq_wrapper (arg ):
102+ try :
103+ return _is_mq (arg )
104+ except OSError as error :
105+ # systemd < 227 compatiblity
106+ assert error .errno == errno .EBADF
107+ return False
108+
92109def test_no_mismatch ():
93110 with closing_socketpair (socket .AF_UNIX ) as pair :
94111 for sock in pair :
95112 assert not is_fifo (sock )
96- assert not is_mq (sock )
113+ assert not is_mq_wrapper (sock )
97114 assert not is_socket_inet (sock )
98115
99116 fd = sock .fileno ()
100117 assert not is_fifo (fd )
101- assert not is_mq (fd )
118+ assert not is_mq_wrapper (fd )
102119 assert not is_socket_inet (fd )
103120
104121 assert not _is_fifo (fd )
105- assert not _is_mq (fd )
122+ assert not _is_mq_wrapper (fd )
106123 assert not _is_socket_inet (fd )
107124
108125def test_is_socket ():
You can’t perform that action at this time.
0 commit comments