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 1717665 - python-pika fails to build with Python 3.8
Summary: python-pika fails to build with Python 3.8
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pika
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Ilia Cheishvili
QA Contact: Fedora Extras Quality Assurance
URL: https://copr.fedorainfracloud.org/cop...
Whiteboard:
Depends On:
Blocks: PYTHON38
TreeView+ depends on / blocked
 
Reported: 2019-06-05 21:44 UTC by Miro Hrončok
Modified: 2019-06-20 07:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-20 07:02:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2019-06-05 21:44:54 UTC
python-pika fails to build with Python 3.8.0b1. See https://copr.fedorainfracloud.org/coprs/g/python/python3.8/package/python-pika/ for actual logs. This report is automated and not very verbose, but I'll get back here with details.

Comment 1 Miro Hrončok 2019-06-05 22:02:39 UTC
======================================================================
FAIL: test_send_method (tests.unit.channel_tests.ChannelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pika-1.0.1/tests/unit/channel_tests.py", line 1662, in test_send_method
    send_method.assert_called_once_with(
  File "/usr/lib64/python3.8/unittest/mock.py", line 881, in assert_called_once_with
    raise AssertionError(msg)
AssertionError: Expected '_send_method' to be called once. Called 0 times.
>>  raise AssertionError("Expected '_send_method' to be called once. Called 0 times.")

Comment 2 Miro Hrončok 2019-06-10 16:43:53 UTC
This issue is blocking the Python 3.8 rebuilds. If this package won't build with 3.8, it won't be installable, along with all its dependent packages, after the side tag is merged.
Furthermore, as it fails to install, its dependent packages will fail to install and/or build as well. The fix should be pushed on the master branch and no release bump is required.

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.8: https://copr.fedorainfracloud.org/coprs/g/python/python3.8/

This issue needs to be resolved by next week, if other rebuilds of Python 3.8 beta 1 go well. If this is unrealistic for you, let us know how much time you need.

If you don't have free cycles to dedicate fixing your package, notify us and we'll try to provide some pointers. Let us know if we can push a fix directly without a pull request, in the case we happen to have one before you do.

We recommend always consulting with upstream, chances are this is already fixed there.

Comment 3 Jeremy Cline 2019-06-10 22:08:37 UTC
I poked at this a little bit (I'll look more tomorrow), but it seems like the test is failing because the _mock_call changed from CallableMixin._mock_call to AsyncMockMixin._mock_call. If that rings any bells, great, otherwise I'll need to go investigate what changed in 3.8 and what exactly pika is doing in this set of tests.

Comment 4 Miro Hrončok 2019-06-11 05:58:05 UTC
I suspect that can be related to https://bugs.python.org/issue26467 and https://github.com/python/cpython/pull/9296

Comment 5 Jeremy Cline 2019-06-11 18:55:10 UTC
Okay I've done more poking.

It looks like the underlying issue is "import inspect; from unittest import mock; inspect.iscoroutinefunction(mock.MagicMock(spec=lambda x: x))" is True. Creating a mock with a function spec leads to f.__code__ to be defined (as a MagicMock), which in turn is used to determine if the function is async in the mock module by ANDing CO_COROUTINE on the mock object, which of course is a truthy (MagicMock) object.

A (maybe) minimal reproducer would be:

from unittest import mock

mock_obj = mock.MagicMock()
mock_obj.mock_func = mock.MagicMock(spec=lambda x: x)

with mock.patch.object(mock_obj, "mock_func") as nested:
    print(type(nested))


I think a fix needs to go into Python's mock to take into account this edge case. Of course, pika shouldn't be mocking out a mock anyway so that should also be fixed. I'm sending a fix to upstream pika now and then I'll see about getting a fix into Python.

Comment 6 Jeremy Cline 2019-06-11 19:40:18 UTC
Okay, I've filed a PR, https://github.com/pika/pika/pull/1225, and added the patch to dist-git, it's python-pika-1.0.1-3 and built in Rawhide. I also left a comment on the PR regarding the Python side of things since I'm not sure how folks might want to fix that.

Comment 7 Miro Hrončok 2019-06-17 09:15:19 UTC
Thanks. The 3.8 rebuild is now blocked by tornado.

Comment 8 Miro Hrončok 2019-06-20 07:02:28 UTC
builds.


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