fraenkel-lab / OmicsIntegrator

This repository is the working directory for the Garnet-Forest bundle of python scripts for analyzing diverse forms of 'omic' data in a network context.
http://fraenkel.mit.edu/omicsintegrator
BSD 2-Clause "Simplified" License
31 stars 21 forks source link

Switch to PyTest test framework, add forest.score() unit test, fix score() bug #4

Closed agitter closed 8 years ago

agitter commented 9 years ago

In preparation for an end-to-end integration test that will check whether garnet and forest reproduce saved results from the example data, we are changing the test framework to PyTest. As a proof-of-concept, we implemented a simple unit test for the score() function that calculates negative prizes for forest. To simplify the test, we moved score() out of the PCSFInput class and made it a standalone function. This revealed a bug in score() - with the musquared option it produced positive prizes instead of negative - which has been fixed.

There are a few questions to be addressed before merging this pull request:

sgosline commented 9 years ago

Great find with the bug and I agree that mu should be >0.

As far as the test framework, I used the cookiecutter template and the requirements were added in. I think by default it would call the python script under tests/. However, it seems that pytest has a different framework for integration with setup.py: https://pytest.org/latest/goodpractises.html, so I'd say go with what they recommend.

sara

agitter commented 8 years ago

The mu > 0 requirement has been addressed:

We are updating setup.py per the PyTest good practices but this is still in progress. One change is that setuptools is now required because distutils does not support some of the preferred test integration. I'll add an update here when this is completed and we are ready to merge.

agitter commented 8 years ago

The score unit test now works with

python setup.py test

This branch can be reviewed and merged.