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 # On Windows, if the handles aren't closed, the files can't be deleted
#os.close(encfno) #os.close(encfno)
#os.close(decfno) #os.close(decfno)
try: key = self.generate_key("Andrew Able", "alpha.com",
key = self.generate_key("Andrew Able", "alpha.com", passphrase="andy")
passphrase="andy") andrew = key.fingerprint
andrew = key.fingerprint key = self.generate_key("Barbara Brown", "beta.com")
key = self.generate_key("Barbara Brown", "beta.com") barbara = key.fingerprint
barbara = key.fingerprint data = "Hello, world!"
data = "Hello, world!" file = util._make_binary_stream(data, self.gpg.encoding)
file = util._make_binary_stream(data, self.gpg.encoding) edata = self.gpg.encrypt_file(file, barbara,
edata = self.gpg.encrypt_file(file, barbara, armor=False, output=encfname)
armor=False, output=encfname) ddata = self.gpg.decrypt_file(efile, passphrase="bbrown",
ddata = self.gpg.decrypt_file(efile, passphrase="bbrown", output=decfname)
output=decfname) encfname.seek(0, 0) # can't use os.SEEK_SET in 2.4
encfname.seek(0, 0) # can't use os.SEEK_SET in 2.4 edata = encfname.read()
edata = encfname.read() ddata = decfname.read()
ddata = decfname.read() data = data.encode(self.gpg.encoding)
data = data.encode(self.gpg.encoding) if ddata != data:
if ddata != data: logger.debug("was: %r", data)
logger.debug("was: %r", data) logger.debug("new: %r", ddata)
logger.debug("new: %r", ddata) self.assertEqual(data, 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")
suites = { 'parsers': set(['test_parsers_fix_unsafe', suites = { 'parsers': set(['test_parsers_fix_unsafe',