Skip to content

Commit 19c3a3b

Browse files
committed
Catch IOError (broken pipe) exception in one more place.
1 parent 1b086ac commit 19c3a3b

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
@@ -1238,8 +1238,13 @@ def test_invalid_outputs(self):
12381238

12391239
for badout, message in cases:
12401240
stream = gnupg._make_binary_stream(data, self.gpg.encoding)
1241-
edata = self.gpg.encrypt_file(stream, barbara, armor=False, output=badout)
1242-
self.assertEqual(2, edata.returncode, 'Unexpected return code')
1241+
try:
1242+
# On Ubuntu and pypy-2.7, you often get an IOError "Broken pipe"
1243+
# during the encrypt operation ...
1244+
edata = self.gpg.encrypt_file(stream, barbara, armor=False, output=badout)
1245+
self.assertEqual(2, edata.returncode, 'Unexpected return code')
1246+
except IOError:
1247+
pass
12431248
# on GnuPG 1.4, you sometimes don't get any FAILURE messages, in
12441249
# which case status will not be set
12451250
if edata.status:

0 commit comments

Comments
 (0)