Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).
https://gromacswrapper.readthedocs.org
GNU General Public License v3.0
169 stars 53 forks source link

make pytest-gmx a local plugin #137

Closed orbeckst closed 6 years ago

orbeckst commented 6 years ago

In PR #102 we are adding the option to restrict mdrun to two threads with the pytest --low-performance option. That uses external code from ianmkenney/pytest-gmx but this code is not pip-installable so this can be inconvenient for users who want to use it.

CHECK: Do the tests run locally without pytest-gmx

Following https://docs.pytest.org/en/latest/writing_plugins.html we can bundle the pytest plugin with our tests. It's only ~10 lines of code https://github.com/ianmkenney/pytest-gmx/blob/master/pytest_gmx.py so this should be easy.

orbeckst commented 6 years ago

Note: as the pytests docs point out, the conftest.py has to be either in the directory where pytest is run or it has to be in the directory that is tested, e.g.

pytest gromacs/tests

will work with gromacs/tests/conftest.py. This is the chosen setup and we use exactly the above line for Travis CI.

NOTE: When testing locally, use something like

cd GromacsWrapper
pytest --low-performance --disable-warnings --cov=gromacs gromacs/tests

(Under Python 2, pytest-xdist works and one can use -n 4 but under Python 3 it appears to be broken.)