aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/tests/support.py')
-rw-r--r--lang/python/tests/support.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index 611986b9..680300c1 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -109,7 +109,13 @@ def EphemeralContext():
agent_socket = os.path.join(tmp, "S.gpg-agent")
ctx.protocol = gpg.constants.protocol.ASSUAN
ctx.set_engine_info(ctx.protocol, file_name=agent_socket)
- ctx.assuan_transact(["KILLAGENT"])
+ try:
+ ctx.assuan_transact(["KILLAGENT"])
+ except gpg.errors.GPGMEError as e:
+ if e.getcode() == gpg.errors.ASS_CONNECT_FAILED:
+ pass # the agent was not running
+ else:
+ raise
# Block until it is really gone.
while os.path.exists(agent_socket):