Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and fix unit tests when run as part of cfgov-refresh #288

Merged
merged 6 commits into from
Nov 8, 2016

Conversation

chosak
Copy link
Member

@chosak chosak commented Nov 7, 2016

This PR fixes Python unit tests so that they can be run in the context of the cfgov-refresh project. It also removes spurious logging during unit tests.

Additions

  • Added required test data file paying_for_college/data_sources/ipeds/test.txt.zip to setup package.

Changes

  • Python unit tests mock print and sys.stdout when necessary to remove spurious output.
  • Fix use of fixture when running tests as part of cfgov-refresh.
  • Skip standalone view tests when run as part of cfgov-refresh.

Testing

  • Run ./pytest.sh from the college-costs root to verify that tests run in standalone mode.

Output should look something like:

.................................................................................................................
----------------------------------------------------------------------
Ran 113 tests in 7.039s

OK
  • From the cfgov-refresh root, run these commands to install this PR branch and invoke the unit tests:
$ pip install git+https://github.com/cfpb/college-costs.git@fix-tests#egg=college-costs
$ cd cfgov
$ DJANGO_SETTINGS_MODULE=cfgov.settings.test python manage.py test paying_for_college

Output should look something like:

..............................................................................................s..................
----------------------------------------------------------------------
Ran 113 tests in 7.141s

OK (skipped=1)

Note that one of the tests is skipped if not run in standalone mode.

Review

Checklist

  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the front end playbook
  • Passes all existing automated tests
  • New functions include new tests
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged
  • Visually tested in supported browsers and devices
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 99.919% when pulling c3b2893 on fix-tests into 7c546ad on master.

Copy link
Member

@higs4281 higs4281 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the instructive cleanup!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 3c21b81 on fix-tests into 7c546ad on master.

@chosak chosak merged commit f91ebb0 into master Nov 8, 2016
@chosak chosak deleted the fix-tests branch November 8, 2016 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants