You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-python/python-systemd/files/231-test_daemon-SO_PASSCRED...

29 lines
1.0 KiB

From a129428dcd92095dc5f3c7ac4b4f096181129063 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
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
--
2.6.4