Fedora Account System
Red Hat Associate
Red Hat Customer
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.
====================================================================== 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.")
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.
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.
I suspect that can be related to https://bugs.python.org/issue26467 and https://github.com/python/cpython/pull/9296
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.
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.
Thanks. The 3.8 rebuild is now blocked by tornado.
builds.