summaryrefslogtreecommitdiff
blob: d62f34ecbeb0d025123749bed09d4706e1108c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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