Skip to main content

pytest plugin for running individual tests with mpiexec

Project description

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):

@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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_mpiexec-0.0.1a2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

pytest_mpiexec-0.0.1a2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pytest_mpiexec-0.0.1a2.tar.gz.

File metadata

  • Download URL: pytest_mpiexec-0.0.1a2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pytest_mpiexec-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 1812224890b83985a2f06b493e00e5802ff4eed4abcc63ccb77d6495f6b891fa
MD5 6dbbd279a9723f7c89d800297ed99c69
BLAKE2b-256 183f6a864f7e6350c5163438dc44591fc7f374aafb4b64b0bc547e9f772038af

See more details on using hashes here.

File details

Details for the file pytest_mpiexec-0.0.1a2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_mpiexec-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 407f1684de4690fffa8382781cf6d2ef6a39b07ec17fc2ab4bdee630a714b65f
MD5 6b80bed78566ddb2b88e607656f5bc61
BLAKE2b-256 83eb0b23189239154316b8652f9cbccb9cd0d374d10ca7fa396daad4ee4b6e31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page