b-thorne / PySM_public

PySM: Software for simulating the Galactic microwave sky
24 stars 29 forks source link

Run tests with runtests #17

Closed zonca closed 6 years ago

zonca commented 6 years ago

@rainwoodman recommended to run tests with runtests, which has the neat feature of supporting MPI tests.

@rainwoodman:

rainwoodman commented 6 years ago

Yes. If you decorate a test with MPITest, then it will be tested with a bunch of communicators. If you don't then it will be run symmetrically on on ranks.

Some examples are in:

https://github.com/rainwoodman/pmesh/tree/master/pmesh/tests

test-domain is fully of MPI tests. test-window is full of non-mpi tests. (You can also mix them in the same file, but that's probably not a good design decision).

The other 'feature' of run-tests.py is that it forces you to make sure the package is fully installable; it installs before testing.

Therefore for finding the tests, you must specify how to install them in setup.py. I find it easiest to install the tests as a subpackage of the main package. e.g. https://github.com/rainwoodman/pmesh/blob/master/setup.py#L49

(don't forget init.py)

There are other "cleaner" ways to install the tests, e.g. with a MANIFEST.in file, but more troublesome.

I shall add some information about this in README.

zonca commented 6 years ago

implemented in #18