pytest-dev/pytest-mock

6 tests fail

yurivict opened this issue · 1 comments

=============================================================================================== FAILURES ================================================================================================
_____________________________________________________________________________________ test_used_with_session_scope ______________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_used_with_session_scope0')>

    def test_used_with_session_scope(testdir: Any) -> None:
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import pytest
            import random
    
            def get_random_number():
                return random.randint(0, 1)
    
            @pytest.fixture(autouse=True, scope="session")
            def randint_mock(session_mocker):
                return session_mocker.patch("random.randint", lambda x, y: 5)
    
            def test_get_random_number():
                assert get_random_number() == 5
        """
        )
        result = testdir.runpytest_subprocess()
        assert "AssertionError" not in result.stderr.str()
>       result.stdout.fnmatch_lines("* 1 passed in *")
E       Failed: nomatch: '* 1 passed in *'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=1413518340'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_session_scope0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_used_with_session_scope.py .                                        [100%]'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 passed, 3 warnings in 0.08s ========================='
E       remains unmatched: '* 1 passed in *'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:1102: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
running: /usr/local/bin/python3.9 -mpytest --basetemp=/tmp/pytest-of-yuri/pytest-64/test_used_with_session_scope0/runpytest-0
     in: /tmp/pytest-of-yuri/pytest-64/test_used_with_session_scope0
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=1413518340
rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_session_scope0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_used_with_session_scope.py .                                        [100%]

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 3 warnings in 0.08s =========================
___________________________________________________________________________________ test_detailed_introspection_async ___________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_detailed_introspection_async0')>

    @pytest.mark.skipif(
        sys.version_info < (3, 8), reason="AsyncMock is present on 3.8 and above"
    )
    @pytest.mark.usefixtures("needs_assert_rewrite")
    def test_detailed_introspection_async(testdir: Any) -> None:
        """Check that the "mock_use_standalone" is being used."""
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import pytest
    
            async def test(mocker):
                m = mocker.AsyncMock()
                await m('fo')
                m.assert_awaited_once_with('', bar=4)
        """
        )
        result = testdir.runpytest("-s")
        expected_lines = [
            "*AssertionError: expected await not found.",
            "*Expected: mock('', bar=4)",
            "*Actual: mock('fo')",
            "*pytest introspection follows:*",
            "*Args:",
            "*assert ('fo',) == ('',)",
            "*At index 0 diff: 'fo' != ''*",
            "*Use -v to get more diff*",
            "*Kwargs:*",
            "*assert {} == {'bar': 4}*",
            "*Right contains* more item*",
            "*{'bar': 4}*",
            "*Use -v to get more diff*",
        ]
>       result.stdout.fnmatch_lines(expected_lines)
E       Failed: nomatch: '*AssertionError: expected await not found.'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=623947827'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_detailed_introspection_async0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_detailed_introspection_async.py s'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: 'test_detailed_introspection_async.py::test'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/python.py:184: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.'
E           and: '  You need to install a suitable plugin for your async framework, for example:'
E           and: '    - anyio'
E           and: '    - pytest-asyncio'
E           and: '    - pytest-tornasync'
E           and: '    - pytest-trio'
E           and: '    - pytest-twisted'
E           and: '    warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))'
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 skipped, 4 warnings in 0.04s ========================'
E       remains unmatched: '*AssertionError: expected await not found.'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:824: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=623947827
rootdir: /tmp/pytest-of-yuri/pytest-64/test_detailed_introspection_async0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_detailed_introspection_async.py s

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

test_detailed_introspection_async.py::test
  /usr/local/lib/python3.9/site-packages/_pytest/python.py:184: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
  You need to install a suitable plugin for your async framework, for example:
    - anyio
    - pytest-asyncio
    - pytest-tornasync
    - pytest-trio
    - pytest-twisted
    warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 skipped, 4 warnings in 0.04s ========================
______________________________________________________________________________________ test_used_with_module_scope ______________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_used_with_module_scope0')>

    def test_used_with_module_scope(testdir: Any) -> None:
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import pytest
            import random
    
            def get_random_number():
                return random.randint(0, 1)
    
            @pytest.fixture(autouse=True, scope="module")
            def randint_mock(module_mocker):
                return module_mocker.patch("random.randint", lambda x, y: 5)
    
            def test_get_random_number():
                assert get_random_number() == 5
        """
        )
        result = testdir.runpytest_subprocess()
        assert "AssertionError" not in result.stderr.str()
>       result.stdout.fnmatch_lines("* 1 passed in *")
E       Failed: nomatch: '* 1 passed in *'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=2653293464'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_module_scope0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_used_with_module_scope.py .                                         [100%]'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 passed, 3 warnings in 0.08s ========================='
E       remains unmatched: '* 1 passed in *'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:1046: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
running: /usr/local/bin/python3.9 -mpytest --basetemp=/tmp/pytest-of-yuri/pytest-64/test_used_with_module_scope0/runpytest-0
     in: /tmp/pytest-of-yuri/pytest-64/test_used_with_module_scope0
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=2653293464
rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_module_scope0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_used_with_module_scope.py .                                         [100%]

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 3 warnings in 0.08s =========================
__________________________________________________________________________________________ test_plain_stopall ___________________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_plain_stopall0')>

    def test_plain_stopall(testdir: Any) -> None:
        """patch.stopall() in a test should not cause an error during unconfigure (#137)"""
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import random
    
            def get_random_number():
                return random.randint(0, 100)
    
            def test_get_random_number(mocker):
                patcher = mocker.mock_module.patch("random.randint", lambda x, y: 5)
                patcher.start()
                assert get_random_number() == 5
                mocker.mock_module.patch.stopall()
        """
        )
        result = testdir.runpytest_subprocess()
>       result.stdout.fnmatch_lines("* 1 passed in *")
E       Failed: nomatch: '* 1 passed in *'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=3279044481'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_plain_stopall0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_plain_stopall.py .                                                  [100%]'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 passed, 3 warnings in 0.08s ========================='
E       remains unmatched: '* 1 passed in *'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:873: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
running: /usr/local/bin/python3.9 -mpytest --basetemp=/tmp/pytest-of-yuri/pytest-64/test_plain_stopall0/runpytest-0
     in: /tmp/pytest-of-yuri/pytest-64/test_plain_stopall0
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=3279044481
rootdir: /tmp/pytest-of-yuri/pytest-64/test_plain_stopall0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_plain_stopall.py .                                                  [100%]

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 3 warnings in 0.08s =========================
_____________________________________________________________________________________ test_used_with_package_scope ______________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_used_with_package_scope0')>

    def test_used_with_package_scope(testdir: Any) -> None:
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import pytest
            import random
    
            def get_random_number():
                return random.randint(0, 1)
    
            @pytest.fixture(autouse=True, scope="package")
            def randint_mock(package_mocker):
                return package_mocker.patch("random.randint", lambda x, y: 5)
    
            def test_get_random_number():
                assert get_random_number() == 5
        """
        )
        result = testdir.runpytest_subprocess()
        assert "AssertionError" not in result.stderr.str()
>       result.stdout.fnmatch_lines("* 1 passed in *")
E       Failed: nomatch: '* 1 passed in *'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=528055882'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_package_scope0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_used_with_package_scope.py .                                        [100%]'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 passed, 3 warnings in 0.07s ========================='
E       remains unmatched: '* 1 passed in *'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:1074: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
running: /usr/local/bin/python3.9 -mpytest --basetemp=/tmp/pytest-of-yuri/pytest-64/test_used_with_package_scope0/runpytest-0
     in: /tmp/pytest-of-yuri/pytest-64/test_used_with_package_scope0
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=528055882
rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_package_scope0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_used_with_package_scope.py .                                        [100%]

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 3 warnings in 0.07s =========================
______________________________________________________________________________________ test_used_with_class_scope _______________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-yuri/pytest-64/test_used_with_class_scope0')>

    def test_used_with_class_scope(testdir: Any) -> None:
        testdir.makeini(
            """
            [pytest]
            asyncio_mode=auto
            """
        )
        testdir.makepyfile(
            """
            import pytest
            import random
            import unittest
    
            def get_random_number():
                return random.randint(0, 1)
    
            @pytest.fixture(autouse=True, scope="class")
            def randint_mock(class_mocker):
                return class_mocker.patch("random.randint", lambda x, y: 5)
    
            class TestGetRandomNumber(unittest.TestCase):
                def test_get_random_number(self):
                    assert get_random_number() == 5
        """
        )
        result = testdir.runpytest_subprocess()
        assert "AssertionError" not in result.stderr.str()
>       result.stdout.fnmatch_lines("* 1 passed in *")
E       Failed: nomatch: '* 1 passed in *'
E           and: '============================= test session starts =============================='
E           and: 'platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0'
E           and: 'Using --randomly-seed=1981389407'
E           and: 'rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_class_scope0, configfile: tox.ini'
E           and: 'plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0'
E           and: 'collected 1 item'
E           and: ''
E           and: 'test_used_with_class_scope.py .                                          [100%]'
E           and: ''
E           and: '=============================== warnings summary ==============================='
E           and: '../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294'
E           and: '  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode'
E           and: '  '
E           and: '    self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E           and: ''
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17'
E           and: '  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.'
E           and: "    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):"
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E           and: '======================== 1 passed, 3 warnings in 0.08s ========================='
E       remains unmatched: '* 1 passed in *'

/usr/ports/devel/py-pytest-mock/work-py39/pytest-mock-3.10.0/tests/test_pytest_mock.py:1018: Failed
----------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------
running: /usr/local/bin/python3.9 -mpytest --basetemp=/tmp/pytest-of-yuri/pytest-64/test_used_with_class_scope0/runpytest-0
     in: /tmp/pytest-of-yuri/pytest-64/test_used_with_class_scope0
============================= test session starts ==============================
platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0
Using --randomly-seed=1981389407
rootdir: /tmp/pytest-of-yuri/pytest-64/test_used_with_class_scope0, configfile: tox.ini
plugins: mock-3.10.0, randomly-3.12.0, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, cov-4.0.0, timeout-2.1.0, forked-1.4.0, anyio-3.6.2, rerunfailures-10.1, xdist-2.5.0, nbval-0.10.0
collected 1 item

test_used_with_class_scope.py .                                          [100%]

=============================== warnings summary ===============================
../../../../usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 passed, 3 warnings in 0.08s =========================
=========================================================================================== warnings summary ============================================================================================
../../../../../local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294
  /usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py:1294: PytestConfigWarning: Unknown config option: asyncio_mode
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

../../../../../local/lib/python3.9/site-packages/pytest_freezegun.py:17: 156 warnings
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

tests/test_pytest_mock.py::test_instance_async_method_spy
  /usr/local/lib/python3.9/site-packages/_pytest/python.py:184: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
  You need to install a suitable plugin for your async framework, for example:
    - anyio
    - pytest-asyncio
    - pytest-tornasync
    - pytest-trio
    - pytest-twisted
    warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================== short test summary info ========================================================================================
SKIPPED [1] ../../../../../local/lib/python3.9/site-packages/_pytest/python.py:185: async def function and no async plugin installed (see warnings)
======================================================================== 6 failed, 71 passed, 1 skipped, 158 warnings in 23.11s =========================================================================
*** Error code 1

Version: 3.10.0
pytest-7.2.0
FreeBSD 13.1
Python-3.9
FreeBSD 13.1

What is happening is that some tests expect to pass without warnings, but seems like pytest-freezegun is installed in the same environment and is generating warnings:

../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
../../../../usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17
  /usr/local/lib/python3.9/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):

The pytest-mock test suite expects the test suite to be run just with the dependencies declared in

pytest-mock/tox.ini

Lines 5 to 9 in 4314bf3

[testenv]
deps =
coverage
mock
pytest-asyncio
, so installing other plugins/packages in the same environment might cause the suite to break.