Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pytest-mpixec

pytest plugin for running individual tests with mpiexec

A test marked with mark.mpiexec will be run in a separate instance with mpiexec, instead of in the current process.

The subprocess test will be run with pytest, so fixtures and everything should still work!

The number of processes can be parametrized if you parametrize an argument called mpiexec_n.

Try it out

pip install pytest-mpiexec

And write tests that use mpiexec:

from mpi4py import MPI

@pytest.mark.mpiexec(n=2)
def test_my_mpi_code(fixtures):
  assert something

@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [1, 2, 3])
def test_my_mpi_code(mpiexec_n):
    assert MPI.COMM_WORLD.size == mpiexec_n

Options

If your mpi executable is not mpiexec for some reason, you can specify it with:

pytest --mpiexec your-mpiexec

pytest-mpiexec tries to reduce noise while still showing useful info for failures. That means only one output should appear when everything's working. But parallel failures can be both noisy and confusing, so there are options here, exposed via the --mpiexec-report option:

option behavior
first_failure show the test output of the first rank with an error (default)
all_failures show output from all ranks that fail (often noisy)
all show all test results (even duplicate PASSED outputs)
concise try to show only each unique failure only once (experimental)

The concise option is experimental and aims to strike a balance between the possibly omitted information from first_failure and the redundant noise of all_failures.

Caveats

If you use module or session-scoped fixtures, another instance will be running, so these can't conflict with other pytest runs (e.g. conflicting on ports, files, etc.)

Prior art

  • pytest-mpi (helpers for tests run inside mpi - compatible with this package!)
  • pytest-easyMPI (similar goal to this one, but takes a different approach)

Release files for pytest-mpiexec 0.0.1a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-mpiexec 0.0.1a3
File Size Uploaded
pytest_mpiexec-0.0.1a3.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-mpiexec 0.0.1a3
File Interpreter ABI Platform
pytest_mpiexec-0.0.1a3-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / pytest_mpiexec-0.0.1a3.tar.gz

Download URL pytest_mpiexec-0.0.1a3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c8a6f816bbc442edd6753dadbd1ff3624665c8fc07c4410589510c28bde030e1
BLAKE2b-256 checksum
How to use checksums
0db5fa5ce1a16e7b58264fce3c4669f1366e6b84cc4e62c61c9a1b19097b45dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / pytest_mpiexec-0.0.1a3-py3-none-any.whl

Download URL pytest_mpiexec-0.0.1a3-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81a724c91576a4321735a32dbe64d1b2a0556218ec175319e4692e6566c4dc10
BLAKE2b-256 checksum
How to use checksums
57b51e46ebf58f279d8a8b4d18e9654ed0f86a727c9e68ee1121d99aabefe58c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page