Name | pytest-mpiexec JSON |
Version |
0.0.1a3
JSON |
| download |
home_page | None |
Summary | pytest plugin for running individual tests with mpiexec |
upload_time | 2024-07-29 13:20:57 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License Copyright (c) 2023 Min RK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
mpi
pytest
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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:
```python
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)
Raw data
{
"_id": null,
"home_page": null,
"name": "pytest-mpiexec",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "mpi, pytest",
"author": null,
"author_email": "Min RK <benjaminrk@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/0d/b5/fa5ce1a16e7b58264fce3c4669f1366e6b84cc4e62c61c9a1b19097b45dd/pytest_mpiexec-0.0.1a3.tar.gz",
"platform": null,
"description": "# pytest-mpixec\n\npytest plugin for running individual tests with mpiexec\n\nA test marked with `mark.mpiexec` will be run in a separate instance with mpiexec,\ninstead of in the current process.\n\nThe subprocess test will be run with pytest,\nso fixtures and everything should still work!\n\nThe number of processes can be parametrized if you parametrize an argument called `mpiexec_n`.\n\n## Try it out\n\n```\npip install pytest-mpiexec\n```\n\nAnd write tests that use mpiexec:\n\n```python\nfrom mpi4py import MPI\n\n@pytest.mark.mpiexec(n=2)\ndef test_my_mpi_code(fixtures):\n assert something\n\n@pytest.mark.mpiexec\n@pytest.mark.parametrize(\"mpiexec_n\", [1, 2, 3])\ndef test_my_mpi_code(mpiexec_n):\n assert MPI.COMM_WORLD.size == mpiexec_n\n\n```\n\n## Options\n\nIf your mpi executable is not `mpiexec` for some reason, you can specify it with:\n\n```\npytest --mpiexec your-mpiexec\n```\n\npytest-mpiexec tries to reduce noise while still showing useful info for failures.\nThat means only one output should appear when everything's working.\nBut parallel failures can be both noisy and confusing, so there are options here,\nexposed via the `--mpiexec-report` option:\n\n| option | behavior |\n| --------------- | ------------------------------------------------------------------- |\n| `first_failure` | show the test output of the first rank with an error (**default**) |\n| `all_failures` | show output from _all_ ranks that fail (often noisy) |\n| `all` | show _all_ test results (even duplicate PASSED outputs) |\n| `concise` | try to show only each _unique_ failure only once (**experimental**) |\n\nThe `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`.\n\n## Caveats\n\nIf you use module or session-scoped fixtures, another instance will be running,\nso these can't conflict with other pytest runs (e.g. conflicting on ports, files, etc.)\n\n## Prior art\n\n- pytest-mpi (helpers for tests run inside mpi - compatible with this package!)\n- pytest-easyMPI (similar goal to this one, but takes a different approach)\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Min RK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "pytest plugin for running individual tests with mpiexec",
"version": "0.0.1a3",
"project_urls": {
"Documentation": "https://github.com/minrk/pytest-mpiexec#readme",
"Issues": "https://github.com/minrk/pytest-mpiexec/issues",
"Source": "https://github.com/minrk/pytest-mpiexec"
},
"split_keywords": [
"mpi",
" pytest"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "57b51e46ebf58f279d8a8b4d18e9654ed0f86a727c9e68ee1121d99aabefe58c",
"md5": "518052f32bab2fb1c642536161871ef4",
"sha256": "81a724c91576a4321735a32dbe64d1b2a0556218ec175319e4692e6566c4dc10"
},
"downloads": -1,
"filename": "pytest_mpiexec-0.0.1a3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "518052f32bab2fb1c642536161871ef4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7312,
"upload_time": "2024-07-29T13:20:55",
"upload_time_iso_8601": "2024-07-29T13:20:55.801733Z",
"url": "https://files.pythonhosted.org/packages/57/b5/1e46ebf58f279d8a8b4d18e9654ed0f86a727c9e68ee1121d99aabefe58c/pytest_mpiexec-0.0.1a3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0db5fa5ce1a16e7b58264fce3c4669f1366e6b84cc4e62c61c9a1b19097b45dd",
"md5": "02729161c7a73ab98eadbd41dff0abf6",
"sha256": "c8a6f816bbc442edd6753dadbd1ff3624665c8fc07c4410589510c28bde030e1"
},
"downloads": -1,
"filename": "pytest_mpiexec-0.0.1a3.tar.gz",
"has_sig": false,
"md5_digest": "02729161c7a73ab98eadbd41dff0abf6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8986,
"upload_time": "2024-07-29T13:20:57",
"upload_time_iso_8601": "2024-07-29T13:20:57.055414Z",
"url": "https://files.pythonhosted.org/packages/0d/b5/fa5ce1a16e7b58264fce3c4669f1366e6b84cc4e62c61c9a1b19097b45dd/pytest_mpiexec-0.0.1a3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-29 13:20:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "minrk",
"github_project": "pytest-mpiexec#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytest-mpiexec"
}