qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nir Soffer <nsoffer@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-block <qemu-block@nongnu.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>
Subject: Re: [PATCH 3/4] iotests: Change imports for Python 3.13
Date: Tue, 2 Jul 2024 20:51:13 +0300	[thread overview]
Message-ID: <52CCCC9F-CAEE-46D2-9698-209A8D1DEA1E@redhat.com> (raw)
In-Reply-To: <CAFn=p-Yz58vhQkQABp7uPPFLuuT_bL=Bdjxz+swsaHPzqS+dVA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1977 bytes --]


> On 2 Jul 2024, at 17:44, John Snow <jsnow@redhat.com> wrote:
> 
> 
> 
> On Tue, Jul 2, 2024 at 7:52 AM Nir Soffer <nsoffer@redhat.com <mailto:nsoffer@redhat.com>> wrote:
>> On Thu, Jun 27, 2024 at 2:23 AM John Snow <jsnow@redhat.com <mailto:jsnow@redhat.com>> wrote:
>> >
>> > Python 3.13 isn't out yet, but it's in beta and Fedora is ramping up to
>> > make it the default system interpreter for Fedora 41.
>> >
>> > They moved our cheese for where ContextManager lives; add a conditional
>> > to locate it while we support both pre-3.9 and 3.13+.
>> >
>> > Signed-off-by: John Snow <jsnow@redhat.com <mailto:jsnow@redhat.com>>
>> > ---
>> >  tests/qemu-iotests/testenv.py    | 7 ++++++-
>> >  tests/qemu-iotests/testrunner.py | 9 ++++++---
>> >  2 files changed, 12 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
>> > index 588f30a4f14..96d69e56963 100644
>> > --- a/tests/qemu-iotests/testenv.py
>> > +++ b/tests/qemu-iotests/testenv.py
>> > @@ -25,7 +25,12 @@
>> >  import random
>> >  import subprocess
>> >  import glob
>> > -from typing import List, Dict, Any, Optional, ContextManager
>> > +from typing import List, Dict, Any, Optional
>> > +
>> > +if sys.version_info >= (3, 9):
>> > +    from contextlib import AbstractContextManager as ContextManager
>> > +else:
>> > +    from typing import ContextManager
>> 
>> It can be cleaner to add a compat module hiding the details so the
>> entire project
>> can have a single instance of this. Other code will just use:
>> 
>>     from compat import ContextManager
> 
> If there were more than two uses, I'd consider it. As it stands, a compat.py module with just one import conditional in it doesn't seem worth the hassle. Are there more cases of compatibility goop inside iotests that need to be factored out to make it worth it?

I don’t about other. For me even one instance is ugly enough :-)


[-- Attachment #2: Type: text/html, Size: 3538 bytes --]

  reply	other threads:[~2024-07-02 17:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 23:22 [PATCH 0/4] Python: Add 3.13 support, play linter whackamole John Snow
2024-06-26 23:22 ` [PATCH 1/4] python: linter changes for pylint 3.x John Snow
2024-07-03  9:50   ` Alex Bennée
2024-06-26 23:22 ` [PATCH 2/4] python: Do not use pylint 3.2.4 with python 3.8 John Snow
2024-07-03  9:50   ` Alex Bennée
2024-06-26 23:22 ` [PATCH 3/4] iotests: Change imports for Python 3.13 John Snow
2024-07-01 23:44   ` John Snow
2024-07-02 11:52   ` Nir Soffer
2024-07-02 14:44     ` John Snow
2024-07-02 17:51       ` Nir Soffer [this message]
2024-07-03 20:12         ` John Snow
2024-06-26 23:22 ` [PATCH 4/4] python: enable testing for 3.13 John Snow
2024-07-03 10:29   ` Alex Bennée
2024-07-05 15:52 ` [PATCH 0/4] Python: Add 3.13 support, play linter whackamole John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CCCC9F-CAEE-46D2-9698-209A8D1DEA1E@redhat.com \
    --to=nsoffer@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).