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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_mpiexec-0.0.1a1.tar.gz
.
File metadata
- Download URL: pytest_mpiexec-0.0.1a1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc71af52d503249995fc6e8f74a3f3361a2af4574aae71665b257610e1484c03 |
|
MD5 | 36385f2c1d87758b7b087a3998d63f8b |
|
BLAKE2b-256 | 9f3852f97f2a66632b1bbe1547ff9ba8121c95c3a43f47bbc59d37efa6e7d430 |
File details
Details for the file pytest_mpiexec-0.0.1a1-py3-none-any.whl
.
File metadata
- Download URL: pytest_mpiexec-0.0.1a1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0eb0ab72a102a498e6d08dabd1abf5898626219d2c141f883a52f1be540c530 |
|
MD5 | 03c400a25789ea3bebc88f480af82b9a |
|
BLAKE2b-256 | a21f3babd2648fb59e0bb0fcf8f57b41891bcabbe34e111811f0aebed2cd7a01 |