Skip to content

PyTest extensions to mark failing tests #13

@kmpaul

Description

@kmpaul

Some tests fail on different platforms with different versions of MPI (MPICH, OpenMPI, etc.). We should provide a way of labeling these tests so they can be skipped. PyTest provides a @pytest.mark.skipif(...) decorator to tell PyTest to skip tests based on a given condition, and I think we want to figure out how to test for different versions and flavors of MPI.

For example, maybe something like this could be done:

import sys
from mpi4py import MPI

@pytest.mark.skipif(MPI.get_vendor()[0] == 'Open MPI' and
                    MPI.get_vendor()[1] < (4, 0, 1) and
                    sys.platform == 'darwin', reason="Doesn't work with OpenMPI 4.0.0 or lower on Macs")
def test_some_thing():
    ...

In this example would skip the test if the tests were being run on an Apple Mac (darwin) running with OpenMPI version 4.0.0 or lower.

...I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions