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:
Note that one of the tests is skipped if not run in standalone mode.
## Review
- @higs4281 @rosskarchner @Scotchester
## Checklist
* [X] Changes are limited to a single goal (no scope creep)
* [X] Code can be automatically merged (no conflicts)
* [ ] Code follows the standards laid out in the [front end playbook](https://github.com/cfpb/front-end)
* [X] 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
* [X] Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
Coverage decreased (-0.08%) to 99.919% when pulling c3b28934ae30d8cef4b2e626a7ca5f3a08b90b95 on fix-tests into 7c546ad9415f1270694d84460d48abee78d3dbf7 on master.
Coverage remained the same at 100.0% when pulling 3c21b816fbb4c0e36577d85eb9041f2967b6f5ed on fix-tests into 7c546ad9415f1270694d84460d48abee78d3dbf7 on master.
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
paying_for_college/data_sources/ipeds/test.txt.zip
to setup package.Changes
print
andsys.stdout
when necessary to remove spurious output.Testing
Run
./pytest.sh
from the college-costs root to verify that tests run in standalone mode.Output should look something like:
OK
$ 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
..............................................................................................s..................
Ran 113 tests in 7.141s
OK (skipped=1)