There are test failures with Python 3.8 and they block the bootstrap of Python 3.8 in Fedora. pytest was also updated to 4.3, but Python 2.7 tests pass, so that is not a probable cause: + py.test-2.7 test_pytest_mock.py ============================= test session starts ============================== platform linux2 -- Python 2.7.16, pytest-4.3.0, py-1.7.0, pluggy-0.9.0 rootdir: /builddir/build/BUILD/pytest-mock-1.10.1, inifile: plugins: mock-1.10.1 collected 48 items test_pytest_mock.py ............................x..x.............s.. [100%] =============================== warnings summary =============================== test_pytest_mock.py::test_deprecated_mock /builddir/build/BUILD/pytest-mock-1.10.1/pytest_mock.py:180: DeprecationWarning: "mock" fixture has been deprecated, use "mocker" instead '"mock" fixture has been deprecated, use "mocker" instead', DeprecationWarning -- Docs: https://docs.pytest.org/en/latest/warnings.html ========= 45 passed, 1 skipped, 2 xfailed, 1 warnings in 1.10 seconds ========== ++ pwd + PYTHONPATH=/builddir/build/BUILD/pytest-mock-1.10.1 + py.test-3.8 test_pytest_mock.py ============================= test session starts ============================== platform linux -- Python 3.8.0a3, pytest-4.3.0, py-1.7.0, pluggy-0.9.0 rootdir: /builddir/build/BUILD/pytest-mock-1.10.1, inifile: plugins: mock-1.10.1 collected 48 items test_pytest_mock.py ...................FFFFF......................F. [100%] =================================== FAILURES =================================== _______________ TestMockerStub.test_failure_message_with_no_name _______________ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6b5340> mocker = <pytest_mock.MockFixture object at 0x7fb56d6b59d0> def test_failure_message_with_no_name(self, mocker): > self.__test_failure_message(mocker) test_pytest_mock.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6b5340> mocker = <pytest_mock.MockFixture object at 0x7fb56d6b59d0>, kwargs = {} expected_name = 'mock', expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='140417201559920'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError('expected call not found.\nExpected: mock()\nActual: not called.') @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' @py_assert6 = False def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" expected_message = "Expected call: {0}()\nNot called".format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:201: AssertionError _____________ TestMockerStub.test_failure_message_with_name[None] ______________ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d651d30> mocker = <pytest_mock.MockFixture object at 0x7fb56d651430>, name = None @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:208: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d651d30> mocker = <pytest_mock.MockFixture object at 0x7fb56d651430> kwargs = {'name': None}, expected_name = 'mock' expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='140417201148928'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError('expected call not found.\nExpected: mock()\nActual: not called.') @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' @py_assert6 = False def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" expected_message = "Expected call: {0}()\nNot called".format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:201: AssertionError _______________ TestMockerStub.test_failure_message_with_name[] ________________ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca0d0> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca3a0>, name = '' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:208: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca0d0> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca3a0> kwargs = {'name': ''}, expected_name = 'mock' expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='140417201644496'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError('expected call not found.\nExpected: mock()\nActual: not called.') @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' @py_assert6 = False def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" expected_message = "Expected call: {0}()\nNot called".format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:201: AssertionError _______________ TestMockerStub.test_failure_message_with_name[f] _______________ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca2b0> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca340>, name = 'f' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:208: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca2b0> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca340> kwargs = {'name': 'f'}, expected_name = 'f' expected_message = 'Expected call: f()\nNot called' stub = <MagicMock name='f' spec='function' id='140417201646032'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError('expected call not found.\nExpected: f()\nActual: not called.') @py_assert4 = 'expected call not found.\nExpected: f()\nActual: not called.' @py_assert6 = False def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" expected_message = "Expected call: {0}()\nNot called".format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: f() E + Expected call: f() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:201: AssertionError ___ TestMockerStub.test_failure_message_with_name[The Castle of aaarrrrggh] ____ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca550> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca760> name = 'The Castle of aaarrrrggh' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:208: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub object at 0x7fb56d6ca550> mocker = <pytest_mock.MockFixture object at 0x7fb56d6ca760> kwargs = {'name': 'The Castle of aaarrrrggh'} expected_name = 'The Castle of aaarrrrggh' expected_message = 'Expected call: The Castle of aaarrrrggh()\nNot called' stub = <MagicMock name='The Castle of aaarrrrggh' spec='function' id='140417201644160'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError('expected call not found.\nExpected: The Castle of aaarrrrggh()\nActual: not called.') @py_assert4 = 'expected call not found.\nExpected: The Castle of aaarrrrggh()\nActual: not called.' @py_assert6 = False def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" expected_message = "Expected call: {0}()\nNot called".format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: The Castle of aaarrrrggh() E + Expected call: The Castle of aaarrrrggh() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:201: AssertionError _________________________ test_detailed_introspection __________________________ testdir = <Testdir local('/tmp/pytest-of-mockbuild/pytest-1/test_detailed_introspection0')> @pytest.mark.usefixtures("needs_assert_rewrite") def test_detailed_introspection(testdir): """Check that the "mock_use_standalone" is being used. """ testdir.makepyfile( """ def test(mocker): m = mocker.Mock() m('fo') m.assert_called_once_with('', bar=4) """ ) result = testdir.runpytest("-s") > result.stdout.fnmatch_lines( [ "*AssertionError: Expected call: mock('', bar=4)*", "*Actual call: mock('fo')*", "*pytest introspection follows:*", "*Args:", "*assert ('fo',) == ('',)", "*At index 0 diff: 'fo' != ''*", "*Use -v to get the full diff*", "*Kwargs:*", "*assert {} == {'bar': 4}*", "*Right contains more items:*", "*{'bar': 4}*", "*Use -v to get the full diff*", ] ) E Failed: nomatch: "*AssertionError: Expected call: mock('', bar=4)*" E and: '============================= test session starts ==============================' E and: 'platform linux -- Python 3.8.0a3, pytest-4.3.0, py-1.7.0, pluggy-0.9.0' E and: 'rootdir: /tmp/pytest-of-mockbuild/pytest-1/test_detailed_introspection0, inifile:' E and: 'plugins: mock-1.10.1' E and: 'collected 1 item' E and: '' E and: 'test_detailed_introspection.py F' E and: '' E and: '=================================== FAILURES ===================================' E and: '_____________________________________ test _____________________________________' E and: '' E and: 'mocker = <pytest_mock.MockFixture object at 0x7fb56d6b5640>' E and: '' E and: ' def test(mocker):' E and: ' m = mocker.Mock()' E and: " m('fo')" E and: "> m.assert_called_once_with('', bar=4)" E and: 'E AssertionError: expected call not found.' E and: "E Expected: mock('', bar=4)" E and: "E Actual: mock('fo')" E and: 'E ' E and: 'E pytest introspection follows:' E and: 'E ' E and: 'E Args:' E and: "E assert ('fo',) == ('',)" E and: "E At index 0 diff: 'fo' != ''" E and: 'E Use -v to get the full diff' E and: 'E Kwargs:' E and: "E assert {} == {'bar': 4}" E and: 'E Right contains more items:' E and: "E {'bar': 4}" E and: 'E Use -v to get the full diff' E and: '' E and: 'test_detailed_introspection.py:4: AssertionError' E and: '=========================== 1 failed in 0.01 seconds ===========================' E and: '' E remains unmatched: "*AssertionError: Expected call: mock('', bar=4)*" /builddir/build/BUILD/pytest-mock-1.10.1/test_pytest_mock.py:588: Failed ----------------------------- Captured stdout call ----------------------------- ============================= test session starts ============================== platform linux -- Python 3.8.0a3, pytest-4.3.0, py-1.7.0, pluggy-0.9.0 rootdir: /tmp/pytest-of-mockbuild/pytest-1/test_detailed_introspection0, inifile: plugins: mock-1.10.1 collected 1 item test_detailed_introspection.py F =================================== FAILURES =================================== _____________________________________ test _____________________________________ mocker = <pytest_mock.MockFixture object at 0x7fb56d6b5640> def test(mocker): m = mocker.Mock() m('fo') > m.assert_called_once_with('', bar=4) E AssertionError: expected call not found. E Expected: mock('', bar=4) E Actual: mock('fo') E E pytest introspection follows: E E Args: E assert ('fo',) == ('',) E At index 0 diff: 'fo' != '' E Use -v to get the full diff E Kwargs: E assert {} == {'bar': 4} E Right contains more items: E {'bar': 4} E Use -v to get the full diff test_detailed_introspection.py:4: AssertionError =========================== 1 failed in 0.01 seconds =========================== =============================== warnings summary =============================== test_pytest_mock.py::test_deprecated_mock /builddir/build/BUILD/pytest-mock-1.10.1/pytest_mock.py:179: DeprecationWarning: "mock" fixture has been deprecated, use "mocker" instead warnings.warn( -- Docs: https://docs.pytest.org/en/latest/warnings.html =============== 6 failed, 42 passed, 1 warnings in 1.29 seconds ================ error: Bad exit status from /var/tmp/rpm-tmp.5SojE4 (%check) That is python-pytest-mock-1.10.1-1.fc31.
Upgrading to 1.10.2 does NOT help.
Fixed upstream in 1.10.3 https://github.com/pytest-dev/pytest-mock/pull/140
https://src.fedoraproject.org/rpms/python-pytest-mock/pull-request/1
1.10.4 fails again: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/build/971242/
Are you sure? From your link, it seems it worked.
That link shows "failed". I've tried again to be sure: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/build/971268/ again "failed" The failure is on Python 2 however (weird): + py.test-2.7 test_pytest_mock.py ============================= test session starts ============================== platform linux2 -- Python 2.7.16, pytest-4.4.1, py-1.8.0, pluggy-0.11.0 rootdir: /builddir/build/BUILD/pytest-mock-1.10.4, inifile: tox.ini plugins: mock-1.10.4 collected 50 items test_pytest_mock.py ...................FFFFF....x..x..............sF.. [100%] =================================== FAILURES =================================== _______________ TestMockerStub.test_failure_message_with_no_name _______________ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d249e0> mocker = <pytest_mock.MockFixture object at 0x7f3916e9ced0> def test_failure_message_with_no_name(self, mocker): > self.__test_failure_message(mocker) test_pytest_mock.py:223: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d249e0> mocker = <pytest_mock.MockFixture object at 0x7f3916e9ced0>, kwargs = {} expected_name = 'mock', msg = 'Expected call: {0}()\nNot called' expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='139883174282960'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError(u'expected call not found.\nExpected: mock()\nActual: not called.',) @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" if PY38: msg = "expected call not found.\nExpected: {0}()\nActual: not called." else: msg = "Expected call: {0}()\nNot called" expected_message = msg.format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:220: AssertionError _____________ TestMockerStub.test_failure_message_with_name[None] ______________ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916eaa638> mocker = <pytest_mock.MockFixture object at 0x7f3916d17e50>, name = None @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:227: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916eaa638> mocker = <pytest_mock.MockFixture object at 0x7f3916d17e50> kwargs = {'name': None}, expected_name = 'mock' msg = 'Expected call: {0}()\nNot called' expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='139883172691024'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError(u'expected call not found.\nExpected: mock()\nActual: not called.',) @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" if PY38: msg = "expected call not found.\nExpected: {0}()\nActual: not called." else: msg = "Expected call: {0}()\nNot called" expected_message = msg.format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:220: AssertionError _______________ TestMockerStub.test_failure_message_with_name[] ________________ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d8b9e0> mocker = <pytest_mock.MockFixture object at 0x7f3916d87410>, name = '' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:227: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d8b9e0> mocker = <pytest_mock.MockFixture object at 0x7f3916d87410> kwargs = {'name': ''}, expected_name = 'mock' msg = 'Expected call: {0}()\nNot called' expected_message = 'Expected call: mock()\nNot called' stub = <MagicMock spec='function' id='139883173148304'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError(u'expected call not found.\nExpected: mock()\nActual: not called.',) @py_assert4 = 'expected call not found.\nExpected: mock()\nActual: not called.' def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" if PY38: msg = "expected call not found.\nExpected: {0}()\nActual: not called." else: msg = "Expected call: {0}()\nNot called" expected_message = msg.format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: mock() E + Expected call: mock() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:220: AssertionError _______________ TestMockerStub.test_failure_message_with_name[f] _______________ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916df9488> mocker = <pytest_mock.MockFixture object at 0x7f3916d9b3d0>, name = 'f' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:227: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916df9488> mocker = <pytest_mock.MockFixture object at 0x7f3916d9b3d0> kwargs = {'name': 'f'}, expected_name = 'f' msg = 'Expected call: {0}()\nNot called' expected_message = 'Expected call: f()\nNot called' stub = <MagicMock name='f' spec='function' id='139883173230992'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError(u'expected call not found.\nExpected: f()\nActual: not called.',) @py_assert4 = 'expected call not found.\nExpected: f()\nActual: not called.' def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" if PY38: msg = "expected call not found.\nExpected: {0}()\nActual: not called." else: msg = "Expected call: {0}()\nNot called" expected_message = msg.format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: f() E + Expected call: f() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:220: AssertionError ___ TestMockerStub.test_failure_message_with_name[The Castle of aaarrrrggh] ____ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d29b48> mocker = <pytest_mock.MockFixture object at 0x7f3916efc4d0> name = 'The Castle of aaarrrrggh' @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh")) def test_failure_message_with_name(self, mocker, name): > self.__test_failure_message(mocker, name=name) test_pytest_mock.py:227: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <test_pytest_mock.TestMockerStub instance at 0x7f3916d29b48> mocker = <pytest_mock.MockFixture object at 0x7f3916efc4d0> kwargs = {'name': 'The Castle of aaarrrrggh'} expected_name = 'The Castle of aaarrrrggh' msg = 'Expected call: {0}()\nNot called' expected_message = 'Expected call: The Castle of aaarrrrggh()\nNot called' stub = <MagicMock name='The Castle of aaarrrrggh' spec='function' id='139883174676176'> exc_info = <ExceptionInfo AssertionError tblen=3> @py_assert2 = AssertionError(u'expected call not found.\nExpected: The Castle of aaarrrrggh()\nActual: not called.',) @py_assert4 = 'expected call not found.\nExpected: The Castle of aaarrrrggh()\nActual: not called.' def __test_failure_message(self, mocker, **kwargs): expected_name = kwargs.get("name") or "mock" if PY38: msg = "expected call not found.\nExpected: {0}()\nActual: not called." else: msg = "Expected call: {0}()\nNot called" expected_message = msg.format(expected_name) stub = mocker.stub(**kwargs) with pytest.raises(AssertionError) as exc_info: stub.assert_called_with() > assert str(exc_info.value) == expected_message E AssertionError: assert 'expected cal...: not called.' == 'Expected call...)\nNot called' E - expected call not found. E - Expected: The Castle of aaarrrrggh() E + Expected call: The Castle of aaarrrrggh() E ? +++++ E - Actual: not called. E + Not called test_pytest_mock.py:220: AssertionError _________________________ test_detailed_introspection __________________________ testdir = <Testdir local('/tmp/pytest-of-mockbuild/pytest-0/test_detailed_introspection0')> @pytest.mark.usefixtures("needs_assert_rewrite") def test_detailed_introspection(testdir): """Check that the "mock_use_standalone" is being used. """ testdir.makepyfile( """ def test(mocker): m = mocker.Mock() m('fo') m.assert_called_once_with('', bar=4) """ ) result = testdir.runpytest("-s") if PY38: expected_lines = [ "*AssertionError: expected call not found.", "*Expected: mock('', bar=4)", "*Actual: mock('fo')", ] else: expected_lines = [ "*AssertionError: Expected call: mock('', bar=4)*", "*Actual call: mock('fo')*", ] expected_lines += [ "*pytest introspection follows:*", "*Args:", "*assert ('fo',) == ('',)", "*At index 0 diff: 'fo' != ''*", "*Use -v to get the full diff*", "*Kwargs:*", "*assert {} == {'bar': 4}*", "*Right contains more items:*", "*{'bar': 4}*", "*Use -v to get the full diff*", ] > result.stdout.fnmatch_lines(expected_lines) E Failed: nomatch: "*AssertionError: Expected call: mock('', bar=4)*" E and: u'============================= test session starts ==============================' E and: u'platform linux2 -- Python 2.7.16, pytest-4.4.1, py-1.8.0, pluggy-0.11.0' E and: u'rootdir: /tmp/pytest-of-mockbuild/pytest-0/test_detailed_introspection0' E and: u'plugins: mock-1.10.4' E and: u'collected 1 item' E and: u'' E and: u'test_detailed_introspection.py F' E and: u'' E and: u'=================================== FAILURES ===================================' E and: u'_____________________________________ test _____________________________________' E anderror: Bad exit status from /var/tmp/rpm-tmp.OTjS7u (%check) : u'' E and: u'mocker = <pytest_mock.MockFixture object at 0x7f3916dde050>' E and: u'' E and: u' def test(mocker):' E and: u' m = mocker.Mock()' E and: u" m('fo')" E and: u"> m.assert_called_once_with('', bar=4)" E and: u'E AssertionError: expected call not found.' E and: u"E Expected: mock('', bar=4)" E and: u"E Actual: mock('fo')" E and: u'E ' E and: u'E pytest introspection follows:' E and: u'E ' E and: u'E Args:' E and: u"E assert ('fo',) == ('',)" E and: u"E At index 0 diff: 'fo' != ''" E and: u'E Use -v to get the full diff' E and: u'E Kwargs:' E and: u"E assert {} == {'bar': 4}" E and: u'E Right contains more items:' E and: u"E {'bar': 4}" E and: u'E Use -v to get the full diff' E and: u'' E and: u'test_detailed_introspection.py:4: AssertionError' E and: u'=========================== 1 failed in 0.01 seconds ===========================' E and: u'' E remains unmatched: "*AssertionError: Expected call: mock('', bar=4)*" /builddir/build/BUILD/pytest-mock-1.10.4/test_pytest_mock.py:646: Failed ----------------------------- Captured stdout call ----------------------------- ============================= test session starts ============================== platform linux2 -- Python 2.7.16, pytest-4.4.1, py-1.8.0, pluggy-0.11.0 rootdir: /tmp/pytest-of-mockbuild/pytest-0/test_detailed_introspection0 plugins: mock-1.10.4 collected 1 item test_detailed_introspection.py F =================================== FAILURES =================================== _____________________________________ test _____________________________________ mocker = <pytest_mock.MockFixture object at 0x7f3916dde050> def test(mocker): m = mocker.Mock() m('fo') > m.assert_called_once_with('', bar=4) E AssertionError: expected call not found. E Expected: mock('', bar=4) E Actual: mock('fo') E E pytest introspection follows: E E Args: E assert ('fo',) == ('',) E At index 0 diff: 'fo' != '' E Use -v to get the full diff E Kwargs: E assert {} == {'bar': 4} E Right contains more items: E {'bar': 4} E Use -v to get the full diff test_detailed_introspection.py:4: AssertionError =========================== 1 failed in 0.01 seconds =========================== =========================== short test summary info ============================ SKIPPED [1] test_pytest_mock.py:580: Py3 only XFAIL test_pytest_mock.py::test_class_method_subclass_spy does not work on Python 2 XFAIL test_pytest_mock.py::test_static_method_subclass_spy does not work on Python 2 FAILED test_pytest_mock.py::TestMockerStub::test_failure_message_with_no_name FAILED test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[None] FAILED test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[] FAILED test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[f] FAILED test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[The Castle of aaarrrrggh] FAILED test_pytest_mock.py::test_detailed_introspection ========== 6 failed, 41 passed, 1 skipped, 2 xfailed in 2.17 seconds ===========
*** This bug has been marked as a duplicate of bug 1732702 ***