Skip to content

python: misc cleanups for python code

Daniel P. Berrangé qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14python: Replace asyncio.get_event_loop for Python 3.14python/qemu/qmp/legacy.py python/qemu/qmp/qmp_tui.py python/tests/protocol.py+6 -33 replies
2/14python: avoid deprecation warning with get_event_looppython/qemu/qmp/legacy.py+6 -13 replies
3/14python: drop 'is_closing' back compat helperpython/qemu/qmp/protocol.py python/qemu/qmp/util.py+1 -182 replies
4/14python: drop 'wait_closed' back compat helperpython/qemu/qmp/protocol.py python/qemu/qmp/util.py+1 -311 reply
5/14python: drop 'asyncio_run' back compat helperpython/qemu/qmp/util.py python/tests/protocol.py+1 -201 reply
6/14python: drop 'create_task' back compat helperpython/qemu/qmp/protocol.py python/qemu/qmp/qmp_tui.py python/qemu/qmp/util.py +1 more+11 -441 reply
7/14iotests: drop compat for old version context managertests/qemu-iotests/testenv.py tests/qemu-iotests/testrunner.py+4 -121 reply
8/14functional: ensure log handlers are closedtests/functional/qemu_test/testcase.py+2 -01 reply
9/14functional: ensure sockets and files are closedtests/functional/test_multiprocess.py tests/functional/test_virtio_gpu.py+5 -03 replies
10/14functional: always enable all python warningstests/functional/qemu_test/testcase.py+4 -02 replies
11/14python: ensure QEMUQtestProtocol closes its socketpython/qemu/machine/qtest.py+2 -02 replies
12/14iotests/147: ensure temporary sockets are closed before exitingtests/qemu-iotests/147+1 -01 reply
13/14iotests/151: ensure subprocesses are cleaned uptests/qemu-iotests/151+5 -02 replies
14/14iotests/check: always enable all python warningstests/qemu-iotests/check+4 -01 reply

Reviews trailers per patch

13 of 14 patches have a Reviewed-by or Acked-by.

PatchThomas HuthEric BlakeAlex BennéeJohn Snow
1/14R-b
2/14R-b R-b
3/14R-b R-b
4/14R-b
5/14R-b
6/14R-b
7/14R-b
8/14R-b
9/14R-b
10/14A-b
11/14R-b
12/14R-b
13/14
14/14R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/14] python: misc cleanups for python code

This spun out of understanding why we didn't get prior warning about our use of the deprecated 'asyncio.get_event_loop' feature. The answer is that python doesn't print any deprecation messages by default unless directly triggered by the __main__ module.

So here I wanted to get all python warning messages enabled for the iotests and functional tests, so we get a heads up of any other failures coming out way.

In doing this it uncovered numerous places where we failed to cleanup with dangling file handles.

I further uncovered lots of old compat code for py3.6 which we stopped needing a long while ago.

I'm in two minds over whether the very last commit is suitable or not though. The iotests do strict comparison of stdout / stderr, so if we allow python warnings to appear that will break the iotests. At the same time though we do really want to see these warnings, especially when developers run the iotests manually, so just turning them on in CI is not very desirable. So wondering how to get the warnings for devs but not for users running from released tarballs?

Also note that I ran 'check', 'check -qcow' and 'check -nbd' but this doesn't cover all possible iotest usage. So there might still be some resource leaks hiding in there which will cause failures for devs running tests with unusual config scenarios.

Daniel P. Berrangé (13):
python: avoid deprecation warning with get_event_loop
python: drop 'is_closing' back compat helper
python: drop 'wait_closed' back compat helper
python: drop 'asyncio_run' back compat helper
python: drop 'create_task' back compat helper
iotests: drop compat for old version context manager
functional: ensure log handlers are closed
functional: ensure sockets and files are closed
functional: always enable all python warnings
python: ensure QEMUQtestProtocol closes its socket iotests/147: ensure temporary sockets are closed before exiting iotests/151: ensure subprocesses are cleaned up iotests/check: always enable all python warnings

Richard W.M. Jones (1):
python: Replace asyncio.get_event_loop for Python 3.14

 python/qemu/machine/qtest.py           |  2 +
 python/qemu/qmp/legacy.py              | 10 ++-
 python/qemu/qmp/protocol.py            | 13 ++--
 python/qemu/qmp/qmp_tui.py             | 10 +--
 python/qemu/qmp/util.py                | 97 +-------------------------
 python/tests/protocol.py               |  9 ++-
 tests/functional/qemu_test/testcase.py |  6 ++
 tests/functional/test_multiprocess.py  |  3 +
 tests/functional/test_virtio_gpu.py    |  2 +
 tests/qemu-iotests/147                 |  1 +
 tests/qemu-iotests/151                 |  5 ++
 tests/qemu-iotests/check               |  4 ++
 tests/qemu-iotests/testenv.py          |  7 +-
 tests/qemu-iotests/testrunner.py       |  9 +--
 14 files changed, 51 insertions(+), 127 deletions(-)
Signature · 1 line
2.49.0