mardi 3 novembre 2020

Python: Running sequential and parallel tests at once

I recently extended the scope of one of the functions of my python module so that it can be executed sequentially or in parallel (with mpi4py).

def foo(param, use_mpi=False):
    pass

When I run my test by hand it works:

# (1) Sequentially
>>> python my_test_seq.py
# (2) In parallel
>>> mpirun -n 3 my_test_par.py

I've been using pytest so far and everything was fine until i wanted to add parallel tests. Indeed, I can't find a way to launch the parallel test (2) with several processes. The only thing I managed to do is to run several pytests in parallel (thus running multiple times a test) but that doesn't meet my needs...

Does anyone know a way to do this ?

Aucun commentaire:

Enregistrer un commentaire