Skip to content

Test failures on Python 3.12 #214

Description

@sanjayankur31

Fedora has just finished rebuilding all its Python packages with Python 3.12. mpd2 has some tests failing in the build at the moment:

+ PYTEST_ADDOPTS=' --ignore=/builddir/build/BUILD/python-mpd2-3.1.0/.pyproject-builddir'
+ PYTEST_XDIST_AUTO_NUM_WORKERS=16
+ HOSTNAME=rpmbuild
+ /usr/bin/python3 -m tox --current-env -q --recreate -e py312
/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py:1274: DeprecationWarning: There is no current event loop
self.loop = asyncio.get_event_loop()
.Exception in callback MPDClient.__idle_result(<CommandResul...abase"\\n\'')>)
handle: <Handle MPDClient.__idle_result(<CommandResul...abase"\\n\'')>)>
Traceback (most recent call last):
File "/usr/lib64/python3.12/asyncio/tasks.py", line 510, in wait_for
return await fut
^^^^^^^^^
File "/usr/lib64/python3.12/asyncio/queues.py", line 158, in get
await getter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 274, in __run
result = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/asyncio/tasks.py", line 509, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib64/python3.12/asyncio/timeouts.py", line 111, in __aexit__
raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1245, in write
next_write = self._expectations[0][0][0]
~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 344, in __idle_result
idle_changes = result.result()
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 311, in __run
self._write_command(result._command, result._args)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/base.py", line 574, in _write_command
self._write_line(cmd)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 392, in _write_line
self.__write(text + "\n")
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 386, in __write
self.__wfile.write(text.encode("utf8"))
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1247, in write
self.error("Data written to mock even though none expected: %r" % data)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1259, in error
raise AssertionError(message)
AssertionError: Data written to mock even though none expected: b'idle "database"\n'
.Exception in callback MPDClient.__idle_result(<CommandResul...ntsong\\n\'')>)
handle: <Handle MPDClient.__idle_result(<CommandResul...ntsong\\n\'')>)>
Traceback (most recent call last):
File "/usr/lib64/python3.12/asyncio/tasks.py", line 510, in wait_for
return await fut
^^^^^^^^^
File "/usr/lib64/python3.12/asyncio/queues.py", line 158, in get
await getter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 274, in __run
result = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/asyncio/tasks.py", line 509, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib64/python3.12/asyncio/timeouts.py", line 111, in __aexit__
raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 344, in __idle_result
idle_changes = result.result()
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 311, in __run
self._write_command(result._command, result._args)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/base.py", line 574, in _write_command
self._write_line(cmd)
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 392, in _write_line
self.__write(text + "\n")
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 386, in __write
self.__wfile.write(text.encode("utf8"))
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1252, in write
self.error("Mock got %r, expected %r" % (data, next_write))
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1259, in error
raise AssertionError(message)
AssertionError: Mock got b'idle "database"\n', expected b'currentsong\n'
E..s........................................................................
======================================================================
ERROR: test_idle_timeout (mpd.tests.TestAsyncioMPD.test_idle_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1589, in test_idle_timeout
self._await(self._test_idle_timeout())
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1303, in _await
return self.loop.run_until_complete(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/tests.py", line 1584, in _test_idle_timeout
await self.client.currentsong()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/python-mpd2-3.1.0/mpd/asyncio.py", line 532, in f
raise ConnectionError("Can not send command to disconnected client")
mpd.base.ConnectionError: Can not send command to disconnected client
----------------------------------------------------------------------
Ran 78 tests in 2.095s
FAILED (errors=1, skipped=1)
py312: exit 1 (2.48 seconds) /builddir/build/BUILD/python-mpd2-3.1.0> coverage run -m unittest mpd.tests pid=262
py312: FAIL code 1 (2.55=setup[0.01]+cmd[0.07,2.48] seconds)
evaluation failed :( (2.58 seconds)

I see a deprecation of get_event_loop(), but I'm not clear what's causing this test fail:

https://docs.python.org/3.12/library/asyncio-eventloop.html#asyncio.get_event_loop

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions