WHO PUTS UNITTESTS IN A TRY/EXCEPT BLOCK WHICH CATCHES ALL EXCEPTIONS?!

* WHAT WAS THE POINT OF WRITING THE UNITTEST IF IT ALWAYS PASSES?
testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-11 18:22:50 +00:00
parent 347cecb9f2
commit ae0ab0a7c7
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 19 additions and 23 deletions

View File

@ -732,29 +732,25 @@ be doing it in the first place. - Eric Schmidt, CEO of Google"""
# On Windows, if the handles aren't closed, the files can't be deleted
#os.close(encfno)
#os.close(decfno)
try:
key = self.generate_key("Andrew Able", "alpha.com",
passphrase="andy")
andrew = key.fingerprint
key = self.generate_key("Barbara Brown", "beta.com")
barbara = key.fingerprint
data = "Hello, world!"
file = util._make_binary_stream(data, self.gpg.encoding)
edata = self.gpg.encrypt_file(file, barbara,
armor=False, output=encfname)
ddata = self.gpg.decrypt_file(efile, passphrase="bbrown",
output=decfname)
encfname.seek(0, 0) # can't use os.SEEK_SET in 2.4
edata = encfname.read()
ddata = decfname.read()
data = data.encode(self.gpg.encoding)
if ddata != data:
logger.debug("was: %r", data)
logger.debug("new: %r", ddata)
self.assertEqual(data, ddata, "Round-trip must work")
except Exception as exc:
logger.warn(exc.message)
logger.debug("test_file_encryption_and_decryption ends")
key = self.generate_key("Andrew Able", "alpha.com",
passphrase="andy")
andrew = key.fingerprint
key = self.generate_key("Barbara Brown", "beta.com")
barbara = key.fingerprint
data = "Hello, world!"
file = util._make_binary_stream(data, self.gpg.encoding)
edata = self.gpg.encrypt_file(file, barbara,
armor=False, output=encfname)
ddata = self.gpg.decrypt_file(efile, passphrase="bbrown",
output=decfname)
encfname.seek(0, 0) # can't use os.SEEK_SET in 2.4
edata = encfname.read()
ddata = decfname.read()
data = data.encode(self.gpg.encoding)
if ddata != data:
logger.debug("was: %r", data)
logger.debug("new: %r", ddata)
self.assertEqual(data, ddata)
suites = { 'parsers': set(['test_parsers_fix_unsafe',