MPI-enabled tests work by spawning a subprocess to run pytest with mpirun. The pytest hook pytest_runtest_call identifies if a given test has the parallel marker and spawns the subprocess. However, if the subprocess finishes without error (that is, the test passes), the main thread then goes on to run the test (without parallelization, in serial mode). If you have a test that will only pass with multiple MPI processes, it will fail at this step. This hasn't come up before because all of our tests have passed in serial mode if they pass in parallel.
MPI-enabled tests work by spawning a subprocess to run pytest with
mpirun
. The pytest hookpytest_runtest_call
identifies if a given test has theparallel
marker and spawns the subprocess. However, if the subprocess finishes without error (that is, the test passes), the main thread then goes on to run the test (without parallelization, in serial mode). If you have a test that will only pass with multiple MPI processes, it will fail at this step. This hasn't come up before because all of our tests have passed in serial mode if they pass in parallel.There's a fairly simple fix to this -- If the subprocess completes (i.e., the parallelized test passes), replace the test function in the main thread with a blank function that doesn't do anything. This has been implemented here: https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/4724f417999025a4080d753549a28cd7c08caac8/pyuvsim/tests/conftest.py#L113-L116