Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).

Home Page:https://gromacswrapper.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make pytest-gmx a local plugin

orbeckst opened this issue · comments

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.

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.)