Bug with parallelized tests which fail in serial mode
Closed this issue · 0 comments
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.
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:
pyuvsim/pyuvsim/tests/conftest.py
Lines 113 to 116 in 4724f41