Testing
Almost all methods and functions within MDMC should have a minimum a single unit test in order to validate the implementation. When contributing code, please ensure that you add suitable unit tests in the relevant module within the tests directory.
In general, MDMC uses pytest for unit testing, although occasionally unittest.mock is also used. Please use pytest unless your tests cannot be written using this framework.
All tests (including system tests) are run from the command line with:
python -m pytest tests/
Testing and LAMMPS/PyLammps
The LAMMPS Python interface (PyLammps) uses stdout
to get output from
the LAMMPS library. By default, pytest redirects stdout
which causes the
majority of tests which use LAMMPS to fail. To fix this, pytest must be forced
to be silent using the -s
flag:
python -m pytest -s tests/