Skip to content

Commit 1b086ac

Browse files
committed
Catch IOError (broken pipe) exception.
1 parent 9038c3f commit 1b086ac

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test_gnupg.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,13 @@ def test_invalid_outputs(self):
12041204
data = 'Hello, world!'
12051205
for badout, message in cases:
12061206
stream = gnupg._make_binary_stream(data, self.gpg.encoding)
1207-
edata = self.gpg.encrypt_file(stream, barbara, armor=False, output=badout)
1208-
self.assertEqual(2, edata.returncode, 'Unexpecteds return code')
1207+
try:
1208+
# On Ubuntu and pypy-2.7, you often get an IOError "Broken pipe"
1209+
# during the encrypt operation ...
1210+
edata = self.gpg.encrypt_file(stream, barbara, armor=False, output=badout)
1211+
self.assertEqual(2, edata.returncode, 'Unexpecteds return code')
1212+
except IOError:
1213+
pass
12091214
# on GnuPG 1.4, you sometimes don't get any FAILURE messages, in
12101215
# which case status will not be set
12111216
if edata.status:

0 commit comments

Comments
 (0)