Description of problem: Package python-pytest-mock fails to build from source in Fedora rawhide. Version-Release number of selected component (if applicable): 1.10.4-1.fc31 Steps to Reproduce: koji build --scratch f31 python-pytest-mock-1.10.4-1.fc31.src.rpm Additional info: This package is tracked by Koschei. See: http://apps.fedoraproject.org/koschei/package/python-pytest-mock This is most likely caused by pytest update from 4.4 to 4.6: ============================= test session starts ============================== platform linux -- Python 3.7.4, pytest-4.6.4, py-1.8.0, pluggy-0.12.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 ...............................................F.. [100%] =================================== FAILURES =================================== _________________________ 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") 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: '============================= test session starts ==============================' E and: 'platform linux -- Python 3.7.4, pytest-4.6.4, py-1.8.0, pluggy-0.12.0' E and: 'rootdir: /tmp/pytest-of-mockbuild/pytest-1/test_detailed_introspection0' E and: 'plugins: mock-1.10.4' 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 0x7fff8d5c8450>' 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 fnmatch: "*AssertionError: Expected call: mock('', bar=4)*" E with: "E AssertionError: Expected call: mock('', bar=4)" E fnmatch: "*Actual call: mock('fo')*" E with: "E Actual call: mock('fo')" E nomatch: '*pytest introspection follows:*' E and: 'E ' E fnmatch: '*pytest introspection follows:*' E with: 'E pytest introspection follows:' E nomatch: '*Args:' E and: 'E ' E fnmatch: '*Args:' E with: 'E Args:' E fnmatch: "*assert ('fo',) == ('',)" E with: "E assert ('fo',) == ('',)" E fnmatch: "*At index 0 diff: 'fo' != ''*" E with: "E At index 0 diff: 'fo' != ''" E fnmatch: '*Use -v to get the full diff*' E with: 'E Use -v to get the full diff' E fnmatch: '*Kwargs:*' E with: 'E Kwargs:' E fnmatch: "*assert {} == {'bar': 4}*" E with: "E assert {} == {'bar': 4}" E nomatch: '*Right contains more items:*' E and: 'E Right contains 1 more item:' 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.08 seconds ===========================' E and: '' E remains unmatched: '*Right contains more items:*' /builddir/build/BUILD/pytest-mock-1.10.4/test_pytest_mock.py:646: Failed ----------------------------- Captured stdout call ----------------------------- ============================= test session starts ============================== platform linux -- Python 3.7.4, pytest-4.6.4, py-1.8.0, pluggy-0.12.0 rootdir: /tmp/pytest-of-mockbuild/pytest-1/test_detailed_introspection0 plugins: mock-1.10.4 collected 1 item test_detailed_introspection.py F =================================== FAILURES =================================== _____________________________________ test _____________________________________ mocker = <pytest_mock.MockFixture object at 0x7fff8d5c8450> def test(mocker): m = mocker.Mock() m('fo') > m.assert_called_once_with('', bar=4) E AssertionError: Expected call: mock('', bar=4) E Actual call: 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 1 more item: E {'bar': 4} E Use -v to get the full diff test_detailed_introspection.py:4: AssertionError =========================== 1 failed in 0.08 seconds =========================== =========================== short test summary info ============================ FAILED test_pytest_mock.py::test_detailed_introspection - Failed: nomatch: "*... ===================== 1 failed, 49 passed in 3.38 seconds ======================
*** Bug 1694192 has been marked as a duplicate of this bug. ***
Fixed with https://koji.fedoraproject.org/koji/taskinfo?taskID=36684165
I still get failures in python2 tests during the 3.8 build: https://copr-be.cloud.fedoraproject.org/results/@python/python3.8/fedora-rawhide-x86_64/00989389-python-pytest-mock/ No idea why it works in Koji. Will recheck.
Koji: ============================= 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 ............................x..x..............s... [100%] ... =============== 47 passed, 1 skipped, 2 xfailed in 1.56 seconds ================ Copr: ============================= 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%] ... ========== 6 failed, 41 passed, 1 skipped, 2 xfailed in 2.26 seconds ===========
It seems that the Python 2 tests are calling "python" and that is Python 3.8, but the ifs for 3.8 fail there.
Scratch that. It's probably more complicated than that.
+ py.test-3.8 test_pytest_mock.py ============================= test session starts ============================== platform linux -- Python 3.8.0b3, pytest-4.6.4, py-1.8.0, pluggy-0.12.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 .................................................. [100%] ========================== 50 passed in 1.71 seconds =========================== To clarify, Python 3.8 tests pass fine, it's the Python 2.7 tests that fail when Python 3.8 is around.
It's mock. Your koji build had python2-mock 2.0.0-13.fc30, my Copr build has 3.0.5-2.fc31. The fix is at: https://github.com/pytest-dev/pytest-mock/commit/b3badafebedea3605c90eb22a68adff2885a8bb0
https://koji.fedoraproject.org/koji/taskinfo?taskID=36697902
This should be fixed in https://koji.fedoraproject.org/koji/taskinfo?taskID=36741265
Thank you!