From 87a9d645500c7adea0bfea34e35562fbdf176054 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Sat, 19 Dec 2015 09:42:49 -0500 Subject: [PATCH] test_daemon: Define a default value for SO_PASSCRED The socket module seems to be missing this in python2.7. --- systemd/test/test_daemon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/systemd/test/test_daemon.py b/systemd/test/test_daemon.py index e055048..8c776d5 100644 --- a/systemd/test/test_daemon.py +++ b/systemd/test/test_daemon.py @@ -228,7 +228,9 @@ def test_notify_with_socket(tmpdir): path = tmpdir.join('socket').strpath sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) sock.bind(path) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_PASSCRED, 1) + # SO_PASSCRED is not defined in python2.7 + SO_PASSCRED = getattr(socket, 'SO_PASSCRED', 16) + sock.setsockopt(socket.SOL_SOCKET, SO_PASSCRED, 1) os.environ['NOTIFY_SOCKET'] = path assert notify('READY=1') == True