Skip to content

Commit

Permalink
test: pubring: fix IPC error
Browse files Browse the repository at this point in the history
This handles the following exception when calling
self.ctx.assuan_transact(["KILLAGENT"]):

GPGMEError: GPGME: IPC connect call failed
  • Loading branch information
vitalikp authored and dmnks committed Jan 22, 2018
1 parent 2c2a766 commit 3fc86fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/pubringtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ def tearDown(self):
agent_socket = os.path.join(self.gpgdir, "S.gpg-agent")
self.ctx.protocol = gpg.constants.protocol.ASSUAN
self.ctx.set_engine_info(self.ctx.protocol, file_name=agent_socket)
self.ctx.assuan_transact(["KILLAGENT"])
try:
self.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):
time.sleep(.01)
Expand Down

0 comments on commit 3fc86fc

Please sign in to comment.