From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: den@openvz.org, Hanna Reitz <hreitz@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>
Subject: Re: [PATCH 2/3] iotests/testrunner.py: move updating last_elapsed to run_tests
Date: Fri, 10 Dec 2021 15:25:52 +0100 [thread overview]
Message-ID: <YbNjcA3GVWbN1SHI@redhat.com> (raw)
In-Reply-To: <CAFn=p-aAB9TXcJkm_cNtAowz_AjWeTvFgyL8kZ7E4zyDqMxF_Q@mail.gmail.com>
Am 06.12.2021 um 18:59 hat John Snow geschrieben:
> On Fri, Dec 3, 2021 at 7:22 AM Vladimir Sementsov-Ogievskiy <
> vsementsov@virtuozzo.com> wrote:
>
> > We are going to use do_run_test() in multiprocessing environment, where
> > we'll not be able to change original runner object.
> >
> > Happily, the only thing we change is that last_elapsed and it's simple
> > to do it in run_tests() instead. All other accesses to self in
> > do_runt_test() and in run_test() are read-only.
> >
> > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> > ---
> > tests/qemu-iotests/testrunner.py | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tests/qemu-iotests/testrunner.py
> > b/tests/qemu-iotests/testrunner.py
> > index fa842252d3..a9f2feb58c 100644
> > --- a/tests/qemu-iotests/testrunner.py
> > +++ b/tests/qemu-iotests/testrunner.py
> > @@ -287,7 +287,6 @@ def do_run_test(self, test: str) -> TestResult:
> > diff=diff, casenotrun=casenotrun)
> > else:
> > f_bad.unlink()
> > - self.last_elapsed.update(test, elapsed)
> > return TestResult(status='pass', elapsed=elapsed,
> > casenotrun=casenotrun)
> >
> > @@ -353,6 +352,9 @@ def run_tests(self, tests: List[str]) -> bool:
> > print('\n'.join(res.diff))
> > elif res.status == 'not run':
> > notrun.append(name)
> > + elif res.status == 'pass':
> > + assert res.elapsed is not None
> > + self.last_elapsed.update(t, res.elapsed)
> >
> > sys.stdout.flush()
> > if res.interrupted:
> > --
> > 2.31.1
> >
> >
> (I continue to be annoyed by the "None" problem in mypy, but I suppose it
> really can't be helped. Nothing for you to change with this patch or
> series. I just wish we didn't need so many assertions ...)
I'm inclined to say it's a None problem in our code, not in mypy.
Essentially it comes from the fact that we're abusing a string
(res.status) and None values to distinguish different types of results
that have a different set of valid attributes.
Of course, Python already provides a language feature to distinguish
different types of results that have a different set of attributes and
that wouldn't run into this problem: subclasses.
Kevin
next prev parent reply other threads:[~2021-12-10 14:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 12:22 [PATCH 0/3] iotests: multiprocessing!! Vladimir Sementsov-Ogievskiy
2021-12-03 12:22 ` [PATCH 1/3] iotests/testrunner.py: add doc string for run_test() Vladimir Sementsov-Ogievskiy
2021-12-06 17:52 ` John Snow
2021-12-10 14:12 ` Kevin Wolf
2021-12-10 14:40 ` Vladimir Sementsov-Ogievskiy
2021-12-03 12:22 ` [PATCH 2/3] iotests/testrunner.py: move updating last_elapsed to run_tests Vladimir Sementsov-Ogievskiy
2021-12-06 17:59 ` John Snow
2021-12-10 14:25 ` Kevin Wolf [this message]
2021-12-10 14:47 ` Vladimir Sementsov-Ogievskiy
2021-12-10 20:05 ` Vladimir Sementsov-Ogievskiy
2021-12-03 12:22 ` [PATCH 3/3] iotests: check: multiprocessing support Vladimir Sementsov-Ogievskiy
2021-12-06 18:35 ` John Snow
2021-12-06 20:20 ` Vladimir Sementsov-Ogievskiy
2021-12-06 21:00 ` John Snow
2021-12-10 14:36 ` Kevin Wolf
2021-12-10 14:46 ` Vladimir Sementsov-Ogievskiy
2021-12-10 16:26 ` Kevin Wolf
2021-12-06 18:37 ` [PATCH 0/3] iotests: multiprocessing!! John Snow
2021-12-06 20:26 ` Vladimir Sementsov-Ogievskiy
2021-12-07 18:20 ` John Snow
2021-12-09 14:33 ` Hanna Reitz
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=YbNjcA3GVWbN1SHI@redhat.com \
--to=kwolf@redhat.com \
--cc=den@openvz.org \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).