vvoelz / biceps

Bayesian inference of conformational populations
https://github.com/vvoelz/biceps
Other
12 stars 3 forks source link

albocycline example tests merge request #81

Closed vvoelz closed 3 years ago

vvoelz commented 3 years ago

For testing, I modified the notebook so the number of steps is smaller. This way, people seeing/running it for the first time aren't waiting 2 min just to see if it works. There's a comment saying the number should be increased for production.

Then I added a testing script called test_albocycline.py that can be tested (along with all other future tests) like this:

(py37) vv@cst14330 albocycline % pytest -v 
========================================== test session starts ===========================================
platform darwin -- Python 3.7.9, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- /Users/vv/anaconda3/envs/py37/bin/python
cachedir: .pytest_cache
rootdir: /Users/vv/git/biceps
collected 1 item                                                                                         

test_albocycline.py::test_albocycline PASSED                                                       [100%]

=========================================== 1 passed in 10.89s ===========================================

The test_albocycline.py script converts the Jupyter notebook to a standalone script, and then tries to run it (by importing it). I had to add a try/except loop to the ipython magic commands because they will only run using ipython, and the testing scripts need to be run on the standard python install.