aragilar / pytest-mpi

Pytest plugin for working with MPI
https://pytest-mpi.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
19 stars 7 forks source link

Tests test_mpi_with_mpi and test_mpi_only_mpi fail #14

Closed badshah400 closed 3 years ago

badshah400 commented 3 years ago

When running the test-suite with pytest two tests fail. This is using

Here is the log:

[    9s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-pytest-mpi-0.4-0.x86_64/usr/lib/python3.8/site-packages
[    9s] + PYTHONDONTWRITEBYTECODE=1
[    9s] + pytest-3.8 -v -p pytester
...
[    9s] docs/markers.rst::line:14,column:1 PASSED                                [  7%]
[    9s] docs/usage.rst::line:16,column:1 PASSED                                  [ 15%]
[    9s] docs/usage.rst::line:28,column:1 PASSED                                  [ 23%]
[   10s] tests/test_fixtures.py::test_mpi_file_name PASSED                        [ 30%]
[   10s] tests/test_fixtures.py::test_mpi_tmpdir PASSED                           [ 38%]
[   10s] tests/test_fixtures.py::test_mpi_tmp_path PASSED                         [ 46%]
[   11s] tests/test_markers.py::test_mpi PASSED                                   [ 53%]
[   12s] tests/test_markers.py::test_mpi_with_mpi FAILED                          [ 61%]
[   13s] tests/test_markers.py::test_mpi_only_mpi FAILED                          [ 69%]
[   13s] tests/test_markers.py::test_mpi_skip PASSED                              [ 76%]
[   14s] tests/test_markers.py::test_mpi_skip_under_mpi PASSED                    [ 84%]
[   14s] tests/test_markers.py::test_mpi_xfail PASSED                             [ 92%]
[   15s] tests/test_markers.py::test_mpi_xfail_under_mpi PASSED                   [100%]
[   15s] 
...
[   15s] =================================== FAILURES ===================================
[   15s] ______________________________ test_mpi_with_mpi _______________________________
[   15s] 
[   15s] mpi_testdir = <Testdir local('/tmp/pytest-of-abuild/pytest-84/test_mpi_with_mpi0')>
[   15s] has_mpi4py = True
[   15s] 
[   15s]     def test_mpi_with_mpi(mpi_testdir, has_mpi4py):
[   15s]         mpi_testdir.makepyfile(MPI_TEST_CODE)
[   15s]     
[   15s]         result = mpi_testdir.runpytest("--with-mpi")
[   15s]     
[   15s]         if has_mpi4py:
[   15s] >           result.assert_outcomes(passed=3, error=1, skipped=1)
[   15s] E           TypeError: assert_outcomes() got an unexpected keyword argument 'error'
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILD/pytest-mpi-0.4/tests/test_markers.py:70: TypeError
[   15s] ------------------------------ Captured log setup ------------------------------
[   15s] WARNING  conftest:conftest.py:25 To run the MPI tests, you need to use subprocesses
[   15s] ----------------------------- Captured stdout call -----------------------------
[   15s] running: mpirun -n 2 /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-abuild/pytest-84/test_mpi_with_mpi0/runpytest-0 --with-mpi
[   15s]      in: /tmp/pytest-of-abuild/pytest-84/test_mpi_with_mpi0
[   15s] ============================= test session starts ==============================
[   15s] platform linux -- Python 3.8.6, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
[   15s] ============================= test session starts ==============================
[   15s] platform linux -- Python 3.8.6, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
[   15s] rootdir: /tmp/pytest-of-abuild/pytest-84/test_mpi_with_mpi0
[   15s] plugins: mpi-0.4
[   15s] collecting ... rootdir: /tmp/pytest-of-abuild/pytest-84/test_mpi_with_mpi0
[   15s] plugins: mpi-0.4
[   15s] collecting ... 
[   15s] collected 5 items                                                              
[   15s] 
[   15s] test_mpi_with_mpi.py 
[   15s] collected 5 items                                                              
[   15s] 
[   15s] test_mpi_with_mpi.py ....ssEE.                                               [100%].
[   15s] 
[   15s] ==================================== ERRORS ====================================
[   15s] _____________________ ERROR at setup of test_size_fail_pos _____________________
[   15s] 
[   15s] self = <pytest_mpi.MPIPlugin object at 0x7fc3168f7340>
[   15s] item = <Function test_size_fail_pos>
[   15s] 
[   15s]     def pytest_runtest_setup(self, item):
[   15s]         """
[   15s]         Hook for doing additional MPI-related checks on mpi marked tests
[   15s]         """
[   15s]         if self._testing_mpi(item.config):
[   15s]             for mark in item.iter_markers(name="mpi"):
[   15s]                 if mark.args:
[   15s] >                   raise ValueError("mpi mark does not take positional args")
[   15s] E                   ValueError: mpi mark does not take positional args
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILDROOT/python-pytest-mpi-0.4-0.x86_64/usr/lib/python3.8/site-packages/pytest_mpi/__init__.py:134: ValueError
[   15s]                                                [100%]=============================== MPI Information ================================
[   15s] rank: 0
[   15s] size: 2
[   15s] MPI version: 3.1
[   15s] MPI library version: Open MPI v2.1.6.0.d9b9e59e5c5a, package: Open MPI Distribution for SUSE, ident: 2.1.6.0.d9b9e59e5c5a, repo rev: 2.1.6.0.d9b9e59e5c5a, OpenMPI 2.1.6 Distribution for SUSE^@
[   15s] MPI vendor: Open MPI 2.1.6
[   15s] mpi4py rc: 
[   15s]  initialize: True
[   15s]  threads: True
[   15s]  thread_level: multiple
[   15s]  finalize: None
[   15s]  fast_reduce: True
[   15s]  recv_mprobe: True
[   15s]  errors: exception
[   15s] mpi4py config:
[   15s]  mpicc: /usr/lib64/mpi/gcc/openmpi2/bin/mpicc
[   15s]  mpicxx: /usr/lib64/mpi/gcc/openmpi2/bin/mpicxx
[   15s]  mpifort: /usr/lib64/mpi/gcc/openmpi2/bin/mpifort
[   15s]  mpif90: /usr/lib64/mpi/gcc/openmpi2/bin/mpif90
[   15s]  mpif77: /usr/lib64/mpi/gcc/openmpi2/bin/mpif77
[   15s] 
[   15s] 
[   15s] ==================================== ERRORS ====================================
[   15s] =========================== short test summary info ============================
[   15s] ERROR test_mpi_with_mpi.py::test_size_fail_pos - ValueError: mpi mark does no...
[   15s] _____________________ ERROR at setup of test_size_fail_pos _____________________
[   15s] 
[   15s] self = <pytest_mpi.MPIPlugin object at 0x7f8962ada340>
[   15s] item = <Function test_size_fail_pos>
[   15s] 
[   15s] ==================== 3 passed, 1 skipped, 1 error in 0.26s =====================
[   15s]     def pytest_runtest_setup(self, item):
[   15s]         """
[   15s]         Hook for doing additional MPI-related checks on mpi marked tests
[   15s]         """
[   15s]         if self._testing_mpi(item.config):
[   15s]             for mark in item.iter_markers(name="mpi"):
[   15s]                 if mark.args:
[   15s] >                   raise ValueError("mpi mark does not take positional args")
[   15s] E                   ValueError: mpi mark does not take positional args
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILDROOT/python-pytest-mpi-0.4-0.x86_64/usr/lib/python3.8/site-packages/pytest_mpi/__init__.py:134: ValueError
[   15s] =============================== MPI Information ================================
[   15s] rank: 1
[   15s] size: 2
[   15s] MPI version: 3.1
[   15s] MPI library version: Open MPI v2.1.6.0.d9b9e59e5c5a, package: Open MPI Distribution for SUSE, ident: 2.1.6.0.d9b9e59e5c5a, repo rev: 2.1.6.0.d9b9e59e5c5a, OpenMPI 2.1.6 Distribution for SUSE^@
[   15s] MPI vendor: Open MPI 2.1.6
[   15s] mpi4py rc: 
[   15s]  initialize: True
[   15s]  threads: True
[   15s]  thread_level: multiple
[   15s]  finalize: None
[   15s]  fast_reduce: True
[   15s]  recv_mprobe: True
[   15s]  errors: exception
[   15s] mpi4py config:
[   15s]  mpicc: /usr/lib64/mpi/gcc/openmpi2/bin/mpicc
[   15s]  mpicxx: /usr/lib64/mpi/gcc/openmpi2/bin/mpicxx
[   15s]  mpifort: /usr/lib64/mpi/gcc/openmpi2/bin/mpifort
[   15s]  mpif90: /usr/lib64/mpi/gcc/openmpi2/bin/mpif90
[   15s]  mpif77: /usr/lib64/mpi/gcc/openmpi2/bin/mpif77
[   15s] =========================== short test summary info ============================
[   15s] ERROR test_mpi_with_mpi.py::test_size_fail_pos - ValueError: mpi mark does no...
[   15s] ==================== 3 passed, 1 skipped, 1 error in 0.25s =====================
[   15s] -------------------------------------------------------
[   15s] Primary job  terminated normally, but 1 process returned
[   15s] a non-zero exit code.. Per user-direction, the job has been aborted.
[   15s] -------------------------------------------------------
[   15s] --------------------------------------------------------------------------
[   15s] mpirun detected that one or more processes exited with non-zero status, thus causing
[   15s] the job to be terminated. The first process to do so was:
[   15s] 
[   15s]   Process name: [[51199,1],1]
[   15s]   Exit code:    1
[   15s] --------------------------------------------------------------------------
[   15s] ______________________________ test_mpi_only_mpi _______________________________
[   15s] 
[   15s] mpi_testdir = <Testdir local('/tmp/pytest-of-abuild/pytest-84/test_mpi_only_mpi0')>
[   15s] has_mpi4py = True
[   15s] 
[   15s]     def test_mpi_only_mpi(mpi_testdir, has_mpi4py):
[   15s]         mpi_testdir.makepyfile(MPI_TEST_CODE)
[   15s]     
[   15s]         result = mpi_testdir.runpytest("--only-mpi")
[   15s]     
[   15s]         if has_mpi4py:
[   15s] >           result.assert_outcomes(passed=2, error=1, skipped=2)
[   15s] E           TypeError: assert_outcomes() got an unexpected keyword argument 'error'
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILD/pytest-mpi-0.4/tests/test_markers.py:81: TypeError
[   15s] ------------------------------ Captured log setup ------------------------------
[   15s] WARNING  conftest:conftest.py:25 To run the MPI tests, you need to use subprocesses
[   15s] ----------------------------- Captured stdout call -----------------------------
[   15s] running: mpirun -n 2 /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-abuild/pytest-84/test_mpi_only_mpi0/runpytest-0 --only-mpi
[   15s]      in: /tmp/pytest-of-abuild/pytest-84/test_mpi_only_mpi0
[   15s] ============================= test session starts ==============================
[   15s] platform linux -- Python 3.8.6, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
[   15s] ============================= test session starts ==============================
[   15s] platform linux -- Python 3.8.6, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
[   15s] rootdir: /tmp/pytest-of-abuild/pytest-84/test_mpi_only_mpi0
[   15s] plugins: mpi-0.4
[   15s] collecting ... rootdir: /tmp/pytest-of-abuild/pytest-84/test_mpi_only_mpi0
[   15s] plugins: mpi-0.4
[   15s] collecting ... 
[   15s] collected 5 items                                                              
[   15s] 
[   15s] test_mpi_only_mpi.py 
[   15s] collected 5 items                                                              
[   15s] 
[   15s] test_mpi_only_mpi.py ....ssEsE                                               [100%]s
[   15s] 
[   15s] ==================================== ERRORS ====================================
[   15s] _____________________ ERROR at setup of test_size_fail_pos _____________________
[   15s] 
[   15s] self = <pytest_mpi.MPIPlugin object at 0x7fd96a29b340>
[   15s] item = <Function test_size_fail_pos>
[   15s] 
[   15s]     def pytest_runtest_setup(self, item):
[   15s]         """
[   15s]         Hook for doing additional MPI-related checks on mpi marked tests
[   15s]         """
[   15s]         if self._testing_mpi(item.config):
[   15s]             for mark in item.iter_markers(name="mpi"):
[   15s]                 if mark.args:
[   15s] >                   raise ValueError("mpi mark does not take positional args")
[   15s] E                   ValueError: mpi mark does not take positional args
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILDROOT/python-pytest-mpi-0.4-0.x86_64/usr/lib/python3.8/site-packages/pytest_mpi/__init__.py:134: ValueError
[   15s] =============================== MPI Information ================================
[   15s] rank: 0
[   15s] size: 2
[   15s] MPI version: 3.1
[   15s] MPI library version: Open MPI v2.1.6.0.d9b9e59e5c5a, package: Open MPI Distribution for SUSE, ident: 2.1.6.0.d9b9e59e5c5a, repo rev: 2.1.6.0.d9b9e59e5c5a, OpenMPI 2.1.6 Distribution for SUSE^@
[   15s] MPI vendor: Open MPI 2.1.6
[   15s] mpi4py rc: 
[   15s]  initialize: True
[   15s]  threads: True
[   15s]                                                [100%] thread_level: multiple
[   15s]  finalize: None
[   15s]  fast_reduce: True
[   15s]  recv_mprobe: True
[   15s]  errors: exception
[   15s] mpi4py config:
[   15s]  mpicc: /usr/lib64/mpi/gcc/openmpi2/bin/mpicc
[   15s]  mpicxx: /usr/lib64/mpi/gcc/openmpi2/bin/mpicxx
[   15s]  mpifort: /usr/lib64/mpi/gcc/openmpi2/bin/mpifort
[   15s]  mpif90: /usr/lib64/mpi/gcc/openmpi2/bin/mpif90
[   15s]  mpif77: /usr/lib64/mpi/gcc/openmpi2/bin/mpif77
[   15s] =========================== short test summary info ============================
[   15s] ERROR test_mpi_only_mpi.py::test_size_fail_pos - ValueError: mpi mark does no...
[   15s] ==================== 2 passed, 2 skipped, 1 error in 0.26s =====================
[   15s] 
[   15s] 
[   15s] ==================================== ERRORS ====================================
[   15s] _____________________ ERROR at setup of test_size_fail_pos _____________________
[   15s] 
[   15s] self = <pytest_mpi.MPIPlugin object at 0x7fa803944340>
[   15s] item = <Function test_size_fail_pos>
[   15s] 
[   15s]     def pytest_runtest_setup(self, item):
[   15s]         """
[   15s]         Hook for doing additional MPI-related checks on mpi marked tests
[   15s]         """
[   15s]         if self._testing_mpi(item.config):
[   15s]             for mark in item.iter_markers(name="mpi"):
[   15s]                 if mark.args:
[   15s] >                   raise ValueError("mpi mark does not take positional args")
[   15s] E                   ValueError: mpi mark does not take positional args
[   15s] 
[   15s] /home/abuild/rpmbuild/BUILDROOT/python-pytest-mpi-0.4-0.x86_64/usr/lib/python3.8/site-packages/pytest_mpi/__init__.py:134: ValueError
[   15s] =============================== MPI Information ================================
[   15s] rank: 1
[   15s] size: 2
[   15s] MPI version: 3.1
[   15s] MPI library version: Open MPI v2.1.6.0.d9b9e59e5c5a, package: Open MPI Distribution for SUSE, ident: 2.1.6.0.d9b9e59e5c5a, repo rev: 2.1.6.0.d9b9e59e5c5a, OpenMPI 2.1.6 Distribution for SUSE^@
[   15s] MPI vendor: Open MPI 2.1.6
[   15s] mpi4py rc: 
[   15s]  initialize: True
[   15s]  threads: True
[   15s]  thread_level: multiple
[   15s]  finalize: None
[   15s]  fast_reduce: True
[   15s]  recv_mprobe: True
[   15s]  errors: exception
[   15s] mpi4py config:
[   15s]  mpicc: /usr/lib64/mpi/gcc/openmpi2/bin/mpicc
[   15s]  mpicxx: /usr/lib64/mpi/gcc/openmpi2/bin/mpicxx
[   15s]  mpifort: /usr/lib64/mpi/gcc/openmpi2/bin/mpifort
[   15s]  mpif90: /usr/lib64/mpi/gcc/openmpi2/bin/mpif90
[   15s]  mpif77: /usr/lib64/mpi/gcc/openmpi2/bin/mpif77
[   15s] =========================== short test summary info ============================
[   15s] ERROR test_mpi_only_mpi.py::test_size_fail_pos - ValueError: mpi mark does no...
[   15s] ==================== 2 passed, 2 skipped, 1 error in 0.25s =====================
[   15s] -------------------------------------------------------
[   15s] Primary job  terminated normally, but 1 process returned
[   15s] a non-zero exit code.. Per user-direction, the job has been aborted.
[   15s] -------------------------------------------------------
[   15s] --------------------------------------------------------------------------
[   15s] mpirun detected that one or more processes exited with non-zero status, thus causing
[   15s] the job to be terminated. The first process to do so was:
[   15s] 
[   15s]   Process name: [[50717,1],0]
[   15s]   Exit code:    1
[   15s] --------------------------------------------------------------------------
[   15s] =============================== warnings summary ===============================
[   15s] docs/markers.rst::line:14,column:1
[   15s] docs/usage.rst::line:16,column:1
[   15s] docs/usage.rst::line:28,column:1
[   15s]   /usr/lib/python3.8/site-packages/sybil/integration/pytest.py:73: PytestDeprecationWarning: _pytest.fixtures.fillfixtures() is deprecated, use function._request.i.
[   15s]     fixtures.fillfixtures(self)
[   15s] 
[   15s] tests/test_fixtures.py::test_mpi_file_name
[   15s] tests/test_fixtures.py::test_mpi_tmpdir
[   15s] tests/test_fixtures.py::test_mpi_tmp_path
[   15s] tests/test_markers.py::test_mpi_with_mpi
[   15s] tests/test_markers.py::test_mpi_only_mpi
[   15s] tests/test_markers.py::test_mpi_skip_under_mpi
[   15s] tests/test_markers.py::test_mpi_xfail_under_mpi
[   15s]   /home/abuild/rpmbuild/BUILD/pytest-mpi-0.4/tests/conftest.py:25: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
[   15s]     log.warn("To run the MPI tests, you need to use subprocesses")
[   15s] 
[   15s] -- Docs: https://docs.pytest.org/en/stable/warnings.html
[   15s] =============================== MPI Information ================================
[   15s] rank: 0
[   15s] size: 1
[   15s] MPI version: 3.1
[   15s] MPI library version: Open MPI v2.1.6.0.d9b9e59e5c5a, package: Open MPI Distribution for SUSE, ident: 2.1.6.0.d9b9e59e5c5a, repo rev: 2.1.6.0.d9b9e59e5c5a, OpenMPI 2.1.6 Distribution for SUSE^@
[   15s] MPI vendor: Open MPI 2.1.6
[   15s] mpi4py rc: 
[   15s]  initialize: True
[   15s]  threads: True
[   15s]  thread_level: multiple
[   15s]  finalize: None
[   15s]  fast_reduce: True
[   15s]  recv_mprobe: True
[   15s]  errors: exception
[   15s] mpi4py config:
[   15s]  mpicc: /usr/lib64/mpi/gcc/openmpi2/bin/mpicc
[   15s]  mpicxx: /usr/lib64/mpi/gcc/openmpi2/bin/mpicxx
[   15s]  mpifort: /usr/lib64/mpi/gcc/openmpi2/bin/mpifort
[   15s]  mpif90: /usr/lib64/mpi/gcc/openmpi2/bin/mpif90
[   15s]  mpif77: /usr/lib64/mpi/gcc/openmpi2/bin/mpif77
[   15s] =========================== short test summary info ============================
[   15s] FAILED tests/test_markers.py::test_mpi_with_mpi - TypeError: assert_outcomes(...
[   15s] FAILED tests/test_markers.py::test_mpi_only_mpi - TypeError: assert_outcomes(...
swt2c commented 3 years ago

See https://github.com/aragilar/pytest-mpi/pull/12

drew-parsons commented 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
drew-parsons commented 3 years ago

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 ===================================================================================
aragilar commented 3 years ago

I've updated and merged #12, so this should now work.