Bug 2278844 - python-dbus-next fails to build with pytest 8: AssertionError: assert ['The name :1...ervice files'] == ['got it']
Summary: python-dbus-next fails to build with pytest 8: AssertionError: assert ['The n...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python-dbus-next
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Aleksei Bavshin
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-05-03 10:08 UTC by Tomáš Hrnčiar
Modified: 2024-07-30 09:46 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-07-30 09:46:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github altdesktop python-dbus-next issues 161 0 None open test/test_fd_passing.py::test_sending_file_descriptor_low_level AssertionError: assert ['The name :1...ervice files'] ==... 2024-05-03 10:08:33 UTC

Description Tomáš Hrnčiar 2024-05-03 10:08:34 UTC
python-dbus-next fails to build with pytest 8.


=================================== FAILURES ===================================
____________________ test_sending_file_descriptor_low_level ____________________

    @pytest.mark.asyncio
    async def test_sending_file_descriptor_low_level():
        bus1 = await MessageBus(negotiate_unix_fd=True).connect()
        bus2 = await MessageBus(negotiate_unix_fd=True).connect()
    
        fd_before = open_file()
        fd_after = None
    
        msg = Message(destination=bus1.unique_name,
                      path='/org/test/path',
                      interface='org.test.iface',
                      member='SomeMember',
                      body=[0],
                      signature='h',
                      unix_fds=[fd_before])
    
        def message_handler(sent):
            nonlocal fd_after
            if sent.sender == bus2.unique_name and sent.serial == msg.serial:
                assert sent.path == msg.path
                assert sent.serial == msg.serial
                assert sent.interface == msg.interface
                assert sent.member == msg.member
                assert sent.body == [0]
                assert len(sent.unix_fds) == 1
                fd_after = sent.unix_fds[0]
                bus1.send(Message.new_method_return(sent, 's', ['got it']))
                bus1.remove_message_handler(message_handler)
                return True
    
        bus1.add_message_handler(message_handler)
    
        reply = await bus2.call(msg)
>       assert reply.body == ['got it']
E       AssertionError: assert ['The name :1...ervice files'] == ['got it']
E         
E         At index 0 diff: 'The name :1.46 was not provided by any .service files' != 'got it'
E         Use -v to get more diff

test/test_fd_passing.py:103: AssertionError
------------------------------ Captured log call -------------------------------
ERROR    asyncio:base_events.py:1821 Future exception was never retrieved
future: <Future finished exception=BrokenPipeError(32, 'Broken pipe')>
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/test/test_disconnect.py", line 27, in test_bus_disconnect_before_reply
    await ping
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 305, in call
    await future
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 63, in write_callback
    self.offset += self.sock.send(self.buf[self.offset:])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe
ERROR    asyncio:base_events.py:1821 Future exception was never retrieved
future: <Future finished exception=OSError(9, 'Bad file descriptor')>
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/test/test_disconnect.py", line 56, in test_unexpected_disconnect
    await bus.wait_for_disconnect()
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 342, in wait_for_disconnect
    return await self._disconnect_future
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 63, in write_callback
    self.offset += self.sock.send(self.buf[self.offset:])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
WARNING  root:message_bus.py:407 could not remove message reader
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 365, in _message_reader
    if self._unmarshaller.unmarshall():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 304, in unmarshall
    self._unmarshall()
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 243, in _unmarshall
    self.read(16, prefetch=True)
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 89, in read
    data = read_sock(missing_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 70, in read_sock
    msg, ancdata, *_ = self.sock.recvmsg(
                       ^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 405, in _finalize
    self._loop.remove_reader(self._fd)
  File "/usr/lib64/python3.12/asyncio/selector_events.py", line 362, in remove_reader
    return self._remove_reader(fd)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/asyncio/selector_events.py", line 307, in _remove_reader
    self._selector.modify(fd, mask, (None, writer))
  File "/usr/lib64/python3.12/selectors.py", line 389, in modify
    self._selector.modify(key.fd, selector_events)
OSError: [Errno 9] Bad file descriptor
=============================== warnings summary ===============================
test/test_aio_low_level.py:103
  test/test_aio_low_level.py:103: PytestDeprecationWarning: test_sending_signals_between_buses is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

test/test_disconnect.py:9
  test/test_disconnect.py:9: PytestDeprecationWarning: test_bus_disconnect_before_reply is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

test/test_disconnect.py:34
  test/test_disconnect.py:34: PytestDeprecationWarning: test_unexpected_disconnect is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

test/test_fd_passing.py:114
  test/test_fd_passing.py:114: PytestDeprecationWarning: test_high_level_service_fd_passing is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

test/test_fd_passing.py:214
  test/test_fd_passing.py:214: PytestDeprecationWarning: test_sending_file_descriptor_with_proxy is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

test/test_tcp_address.py:10
  test/test_tcp_address.py:10: PytestDeprecationWarning: test_tcp_connection_with_forwarding is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    @pytest.mark.asyncio

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_fd_passing.py::test_sending_file_descriptor_low_level - Asse...
====== 1 failed, 73 passed, 7 skipped, 1 deselected, 6 warnings in 0.50s =======
Future exception was never retrieved
future: <Future finished exception=OSError(9, 'Bad file descriptor')>
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/aio/message_bus.py", line 365, in _message_reader
    if self._unmarshaller.unmarshall():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 304, in unmarshall
    self._unmarshall()
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 243, in _unmarshall
    self.read(16, prefetch=True)
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 89, in read
    data = read_sock(missing_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-dbus-next-0.2.3/dbus_next/_private/unmarshaller.py", line 70, in read_sock
    msg, ancdata, *_ = self.sock.recvmsg(
                       ^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
error: Bad exit status from /var/tmp/rpm-tmp.iW0Auc (%check)
    Bad exit status from /var/tmp/rpm-tmp.iW0Auc (%check)

RPM build errors:
Finish: rpmbuild python-dbus-next-0.2.3-9.fc41.src.rpm

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07388758-python-dbus-next/

For all our attempts to build python-dbus-next with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-dbus-next/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Tomáš Hrnčiar 2024-07-30 09:46:54 UTC
I've got a successful build with pytest 8.3.1 - https://copr.fedorainfracloud.org/coprs/thrnciar/pytest-8.3.1/build/7769610/


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