diff options
author | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-02-20 11:14:57 -0800 |
---|---|---|
committer | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-02-20 11:14:57 -0800 |
commit | 9bc46ed446436c8ade9df4a2de41d7dca9357167 (patch) | |
tree | 4d732a20f1e5776d8780a9323675e5b625b1254f /tests/test_file.py | |
parent | 1f1821653d63c68e657965da4525f04a846c18d0 (diff) | |
download | oauth2client-9bc46ed446436c8ade9df4a2de41d7dca9357167.tar.gz |
Removing all uses of self.fail().
Replacing instead with assertRaises statements.
Diffstat (limited to 'tests/test_file.py')
-rw-r--r-- | tests/test_file.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/test_file.py b/tests/test_file.py index 84980eb..7ecc620 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -24,7 +24,7 @@ import os import pickle import stat import tempfile -import unittest +import unittest2 from .http_mock import HttpMockSequence import six @@ -45,7 +45,7 @@ _filehandle, FILENAME = tempfile.mkstemp('oauth2client_test.data') os.close(_filehandle) -class OAuth2ClientFileTests(unittest.TestCase): +class OAuth2ClientFileTests(unittest2.TestCase): def tearDown(self): try: @@ -85,10 +85,8 @@ class OAuth2ClientFileTests(unittest.TestCase): os.symlink(FILENAME, SYMFILENAME) s = file.Storage(SYMFILENAME) try: - s.get() - self.fail('Should have raised an exception.') - except file.CredentialsFileSymbolicLinkError: - pass + with self.assertRaises(file.CredentialsFileSymbolicLinkError): + s.get() finally: os.unlink(SYMFILENAME) @@ -246,4 +244,4 @@ class OAuth2ClientFileTests(unittest.TestCase): if __name__ == '__main__': # pragma: NO COVER - unittest.main() + unittest2.main() |