summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-10-25 16:43:58 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-10-25 16:50:59 -0400
commit1d8f5f26dfeeacfd13ec2bb2783a5638d3eb1c13 (patch)
treeb12ebf64fcae72ff4143b79d9e1ff537931347bf
parent4be2fc75bf405ae5e2cac3d8df99e88b46392744 (diff)
downloadpython-systemd-1d8f5f26dfeeacfd13ec2bb2783a5638d3eb1c13.tar.gz
tests: work around bug in sd_is_mq
The fix was committed in v226-362-g0260d1d542.
-rw-r--r--systemd/test/test_daemon.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/systemd/test/test_daemon.py b/systemd/test/test_daemon.py
index e412e2e..af14f94 100644
--- a/systemd/test/test_daemon.py
+++ b/systemd/test/test_daemon.py
@@ -3,6 +3,7 @@ import os
import posix
import socket
import contextlib
+import errno
from systemd.daemon import (booted,
is_fifo, _is_fifo,
is_socket, _is_socket,
@@ -89,20 +90,36 @@ def test_is_fifo_bad_fd(tmpdir):
with pytest.raises(OSError):
assert not is_fifo(-1, path)
+def is_mq_wrapper(arg):
+ try:
+ return is_mq(arg)
+ except OSError as error:
+ # systemd < 227 compatiblity
+ assert error.errno == errno.EBADF
+ return False
+
+def _is_mq_wrapper(arg):
+ try:
+ return _is_mq(arg)
+ except OSError as error:
+ # systemd < 227 compatiblity
+ assert error.errno == errno.EBADF
+ return False
+
def test_no_mismatch():
with closing_socketpair(socket.AF_UNIX) as pair:
for sock in pair:
assert not is_fifo(sock)
- assert not is_mq(sock)
+ assert not is_mq_wrapper(sock)
assert not is_socket_inet(sock)
fd = sock.fileno()
assert not is_fifo(fd)
- assert not is_mq(fd)
+ assert not is_mq_wrapper(fd)
assert not is_socket_inet(fd)
assert not _is_fifo(fd)
- assert not _is_mq(fd)
+ assert not _is_mq_wrapper(fd)
assert not _is_socket_inet(fd)
def test_is_socket():