Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1732702 - python-pytest-mock: FTBFS in Fedora rawhide
Summary: python-pytest-mock: FTBFS in Fedora rawhide
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pytest-mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Julien Enselme
QA Contact: Fedora Extras Quality Assurance
URL: http://apps.fedoraproject.org/koschei...
Whiteboard:
: 1694192 (view as bug list)
Depends On:
Blocks: F31FTBFS PYTHON38 1732841
TreeView+ depends on / blocked
 
Reported: 2019-07-24 07:38 UTC by Miro Hrončok
Modified: 2019-08-02 17:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-02 17:21:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2019-07-24 07:38:32 UTC
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 ======================

Comment 1 Miro Hrončok 2019-07-28 22:32:51 UTC
*** Bug 1694192 has been marked as a duplicate of this bug. ***

Comment 2 Julien Enselme 2019-07-30 19:23:03 UTC
Fixed with https://koji.fedoraproject.org/koji/taskinfo?taskID=36684165

Comment 3 Miro Hrončok 2019-07-31 00:19:57 UTC
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.

Comment 4 Miro Hrončok 2019-07-31 00:29:50 UTC
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 ===========

Comment 5 Miro Hrončok 2019-07-31 00:32:38 UTC
It seems that the Python 2 tests are calling "python" and that is Python 3.8, but the ifs for 3.8 fail there.

Comment 6 Miro Hrončok 2019-07-31 00:44:18 UTC
Scratch that. It's probably more complicated than that.

Comment 7 Miro Hrončok 2019-07-31 01:04:02 UTC
+ 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.

Comment 8 Miro Hrončok 2019-07-31 01:12:10 UTC
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

Comment 10 Julien Enselme 2019-08-01 20:24:08 UTC
This should be fixed in https://koji.fedoraproject.org/koji/taskinfo?taskID=36741265

Comment 11 Miro Hrončok 2019-08-02 17:21:39 UTC
Thank you!


Note You need to log in before you can comment on or make changes to this bug.