Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Improved unit-test line coverage and quality. #356

Merged
merged 1 commit into from
Dec 15, 2015

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Dec 5, 2015

In particular

  • Upgraded some unit test modules to unittest2.
  • Got to 100% line coverage in test_jwt, test_clientsecrets,
    and test_service_account by using self.assertRaises
    instead of self.fail()
  • In some places used self.assertRaises as a context manager so
    the thrown exception can be inspected / compared against. This
    is done instead of manually catching the exception and
    holding on to it (unittest2 backports this feature from
    unittest that was not available in Python 2.6)
  • Added license to test_multistore_file
  • Removed legacy python2.4 hashbang from test_jwt and
    test_service_account
  • Added unittest2 as a test dependency in tox.ini
  • Updated test_clientsecrets.test_load_by_filename_missing_file
    to use the self.assertRaises context manager (this was
    a problem in More informative error when failing to open secrets file. #349 and More informative error when failing to open secrets file. #350)
  • Updated test_jwt module docstring to reflect actual purpose

@dhermes
Copy link
Contributor Author

dhermes commented Dec 14, 2015

@nathanielmanistaatgoogle PTAL

#!/usr/bin/python2.4
#
# Copyright 2014 Google Inc. All rights reserved.
# Copyright 2015 Google Inc. All rights reserved.

This comment was marked as spam.

This comment was marked as spam.

In particular

- Upgraded some unit test modules to `unittest2`.
- Got to 100% line coverage in `test_jwt`, `test_clientsecrets`,
  and `test_service_account` by using `self.assertRaises`
  instead of `self.fail()`
- In some places used `self.assertRaises` as a context manager so
  the thrown exception can be inspected / compared against. This
  is done instead of manually catching the exception and
  holding on to it (`unittest2` backports this feature from
  `unittest` that was not available in Python 2.6)
- Added license to `test_multistore_file`
- Removed legacy `python2.4` hashbang from `test_jwt` and
  `test_service_account`
- Added `unittest2` as a test dependency in `tox.ini`
- Updated `test_clientsecrets.test_load_by_filename_missing_file`
  to use the `self.assertRaises` context manager (this was
  a problem in googleapis#349 and googleapis#350)
- Updated `test_jwt` module docstring to reflect actual purpose
@dhermes
Copy link
Contributor Author

dhermes commented Dec 14, 2015

@nathanielmanistaatgoogle Changes addressed. PTAL

@nathanielmanistaatgoogle
Copy link
Contributor

Looks good; merge when tests pass for the edited commit.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 14, 2015

Thanks!

dhermes added a commit that referenced this pull request Dec 15, 2015
Improved unit-test line coverage and quality.
@dhermes dhermes merged commit 682baf0 into googleapis:master Dec 15, 2015
@dhermes dhermes deleted the remove-unittest-fail branch December 15, 2015 05:56
@dhermes dhermes mentioned this pull request Jan 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants