Closed badshah400 closed 3 years ago
As far as I can tell the PR needs to add
--- pytest-mpi.orig/tests/test_markers.py 2021-01-23 00:55:32.883507876 +0100
+++ pytest-mpi/tests/test_markers.py 2021-01-23 01:02:05.074814005 +0100
@@ -22,7 +22,7 @@
assert comm.size >= 4
- @pytest.mark.mpi(2)
+ @pytest.mark.mpi(min_size=2)
def test_size_fail_pos():
from mpi4py import MPI
comm = MPI.COMM_WORLD
for test_size_fail_pos
.
Otherwise it still gives the error
> raise ValueError("mpi mark does not take positional args")
E ValueError: mpi mark does not take positional args
After applying PR #12 and the patch in the previous comment, these two tests still fail:
$ python3 -m pytest -k "test_mpi_with_mpi or test_mpi_only_mpi" -p pytester -vv
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/projects/python/build/pytest-mpi/.hypothesis/examples')
rootdir: /projects/python/build/pytest-mpi
plugins: cov-2.10.1, mpi-0+untagged.41.g7f6185d.dirty, doctestplus-0.9.0, remotedata-0.3.2, filter-subpackage-0.1.1, arraydiff-0.3, astropy-header-0.1.2, hypothesis-5.43.3, openfiles-0.5.0
collected 13 items / 11 deselected / 2 selected
tests/test_markers.py::test_mpi_with_mpi FAILED [ 50%]
tests/test_markers.py::test_mpi_only_mpi FAILED [100%]
==================================================================================================== FAILURES =====================================================================================================
________________________________________________________________________________________________ test_mpi_with_mpi ________________________________________________________________________________________________
mpi_testdir = <Testdir local('/tmp/pytest-of-projects/pytest-12/test_mpi_with_mpi0')>, has_mpi4py = True
def test_mpi_with_mpi(mpi_testdir, has_mpi4py):
mpi_testdir.makepyfile(MPI_TEST_CODE)
result = mpi_testdir.runpytest("--with-mpi")
if has_mpi4py:
> result.assert_outcomes(passed=3, errors=1, skipped=1)
E AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 4,\n 'skipped': 1,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 1,\n 'xfailed': 0,\n 'xpassed': 0}
E Common items:
E {'failed': 0, 'skipped': 1, 'xfailed': 0, 'xpassed': 0}
E Differing items:
E {'passed': 4} != {'passed': 3}
E {'errors': 0} != {'errors': 1}
E Full diff:
E {
E - 'errors': 1,
E ? ^
E + 'errors': 0,
E ? ^
E 'failed': 0,
E - 'passed': 3,
E ? ^
E + 'passed': 4,
E ? ^
E 'skipped': 1,
E 'xfailed': 0,
E 'xpassed': 0,
E }
/projects/python/build/pytest-mpi/tests/test_markers.py:70: AssertionError
----------------------------------------------------------------------------------------------- Captured log setup ------------------------------------------------------------------------------------------------
WARNING conftest:conftest.py:25 To run the MPI tests, you need to use subprocesses
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
running: mpirun -n 2 /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-projects/pytest-12/test_mpi_with_mpi0/runpytest-0 --with-mpi
in: /tmp/pytest-of-projects/pytest-12/test_mpi_with_mpi0
============================= test session starts ==============================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /tmp/pytest-of-projects/pytest-12/test_mpi_with_mpi0
plugins: cov-2.10.1, mpi-0+untagged.41.g7f6185d.dirty, doctestplus-0.9.0, remotedata-0.3.2, filter-subpackage-0.1.1, arraydiff-0.3, astropy-header-0.1.2, hypothesis-5.43.3, openfiles-0.5.0
collecting ... ============================= test session starts ==============================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
collected 5 items
test_mpi_with_mpi.py rootdir: /tmp/pytest-of-projects/pytest-12/test_mpi_with_mpi0
plugins: cov-2.10.1, mpi-0+untagged.41.g7f6185d.dirty, doctestplus-0.9.0, remotedata-0.3.2, filter-subpackage-0.1.1, arraydiff-0.3, astropy-header-0.1.2, hypothesis-5.43.3, openfiles-0.5.0
collecting ...
collected 5 items
test_mpi_with_mpi.py ....ss... [100%]. [100%]
=============================== MPI Information ================================
rank: 0
size: 2
MPI version: 3.1
MPI library version: Open MPI v4.1.0, package: Debian OpenMPI, ident: 4.1.0, repo rev: v4.1.0, Dec 18, 2020
MPI vendor: Open MPI 4.1.0
mpi4py rc:
initialize: True
threads: True
thread_level: multiple
finalize: None
fast_reduce: True
recv_mprobe: True
errors: exception
mpi4py config:
=============================== MPI Information ================================
rank: 1
size: 2
MPI version: 3.1
MPI library version: Open MPI v4.1.0, package: Debian OpenMPI, ident: 4.1.0, repo rev: v4.1.0, Dec 18, 2020
MPI vendor: Open MPI 4.1.0
mpi4py rc:
initialize: True
threads: True
thread_level: multiple
finalize: None
fast_reduce: True
recv_mprobe: True
errors: exception
mpi4py config:
mpicc: /usr/bin/mpicc
mpicxx: /usr/bin/mpicxx
========================= 4 passed, 1 skipped in 0.24s =========================
mpicc: /usr/bin/mpicc
mpicxx: /usr/bin/mpicxx
========================= 4 passed, 1 skipped in 0.24s =========================
________________________________________________________________________________________________ test_mpi_only_mpi ________________________________________________________________________________________________
mpi_testdir = <Testdir local('/tmp/pytest-of-projects/pytest-12/test_mpi_only_mpi0')>, has_mpi4py = True
def test_mpi_only_mpi(mpi_testdir, has_mpi4py):
mpi_testdir.makepyfile(MPI_TEST_CODE)
result = mpi_testdir.runpytest("--only-mpi")
if has_mpi4py:
> result.assert_outcomes(passed=2, errors=1, skipped=2)
E AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 2,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed': 2,\n 'skipped': 2,\n 'xfailed': 0,\n 'xpassed': 0}
E Common items:
E {'failed': 0, 'skipped': 2, 'xfailed': 0, 'xpassed': 0}
E Differing items:
E {'passed': 3} != {'passed': 2}
E {'errors': 0} != {'errors': 1}
E Full diff:
E {
E - 'errors': 1,
E ? ^
E + 'errors': 0,
E ? ^
E 'failed': 0,
E - 'passed': 2,
E ? ^
E + 'passed': 3,
E ? ^
E 'skipped': 2,
E 'xfailed': 0,
E 'xpassed': 0,
E }
/projects/python/build/pytest-mpi/tests/test_markers.py:81: AssertionError
----------------------------------------------------------------------------------------------- Captured log setup ------------------------------------------------------------------------------------------------
WARNING conftest:conftest.py:25 To run the MPI tests, you need to use subprocesses
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
running: mpirun -n 2 /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-projects/pytest-12/test_mpi_only_mpi0/runpytest-0 --only-mpi
in: /tmp/pytest-of-projects/pytest-12/test_mpi_only_mpi0
============================= test session starts ==============================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /tmp/pytest-of-projects/pytest-12/test_mpi_only_mpi0
plugins: cov-2.10.1, mpi-0+untagged.41.g7f6185d.dirty, doctestplus-0.9.0, remotedata-0.3.2, filter-subpackage-0.1.1, arraydiff-0.3, astropy-header-0.1.2, hypothesis-5.43.3, openfiles-0.5.0
collecting ... ============================= test session starts ==============================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /tmp/pytest-of-projects/pytest-12/test_mpi_only_mpi0
plugins: cov-2.10.1, mpi-0+untagged.41.g7f6185d.dirty, doctestplus-0.9.0, remotedata-0.3.2, filter-subpackage-0.1.1, arraydiff-0.3, astropy-header-0.1.2, hypothesis-5.43.3, openfiles-0.5.0
collecting ...
collected 5 items
test_mpi_only_mpi.py
collected 5 items
test_mpi_only_mpi.py ....ss..s [100%]s [100%]
=============================== MPI Information ================================
rank: 1
size: 2
MPI version: 3.1
MPI library version: Open MPI v4.1.0, package: Debian OpenMPI, ident: 4.1.0, repo rev: v4.1.0, Dec 18, 2020
MPI vendor: Open MPI 4.1.0
mpi4py rc:
initialize: True
threads: True
thread_level: multiple
finalize: None
fast_reduce: True
recv_mprobe: True
errors: exception
mpi4py config:
mpicc: /usr/bin/mpicc
mpicxx: /usr/bin/mpicxx
========================= 3 passed, 2 skipped in 0.25s =========================
=============================== MPI Information ================================
rank: 0
size: 2
MPI version: 3.1
MPI library version: Open MPI v4.1.0, package: Debian OpenMPI, ident: 4.1.0, repo rev: v4.1.0, Dec 18, 2020
MPI vendor: Open MPI 4.1.0
mpi4py rc:
initialize: True
threads: True
thread_level: multiple
finalize: None
fast_reduce: True
recv_mprobe: True
errors: exception
mpi4py config:
mpicc: /usr/bin/mpicc
mpicxx: /usr/bin/mpicxx
========================= 3 passed, 2 skipped in 0.24s =========================
================================================================================================ warnings summary =================================================================================================
tests/test_markers.py::test_mpi_with_mpi
tests/test_markers.py::test_mpi_only_mpi
/projects/python/build/pytest-mpi/tests/conftest.py:25: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
log.warn("To run the MPI tests, you need to use subprocesses")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================================================= short test summary info =============================================================================================
FAILED tests/test_markers.py::test_mpi_with_mpi - AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 4,\n 'skipped': 1,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed':...
FAILED tests/test_markers.py::test_mpi_only_mpi - AssertionError: assert {'errors': 0,\n 'failed': 0,\n 'passed': 3,\n 'skipped': 2,\n 'xfailed': 0,\n 'xpassed': 0} == {'errors': 1,\n 'failed': 0,\n 'passed':...
================================================================================== 2 failed, 11 deselected, 2 warnings in 5.41s ===================================================================================
I've updated and merged #12, so this should now work.
When running the test-suite with pytest two tests fail. This is using
Here is the log: