[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 9/9] iotests.py: use io.StringIO with python3
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-block] [PATCH 9/9] iotests.py: use io.StringIO with python3 |
Date: |
Wed, 20 Dec 2017 10:10:01 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Tue, Dec 19, 2017 at 02:34:25PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> tests/qemu-iotests/iotests.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrange <address@hidden>
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 4c515d2e6c..0e1b8ab6e6 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -459,13 +459,16 @@ def main(supported_fmts=[], supported_oses=['linux']):
>
> # We need to filter out the time taken from the output so that
> qemu-iotest
> # can reliably diff the results against master output.
> - import StringIO
> if debug:
> output = sys.stdout
> verbosity = 2
> sys.argv.remove('-d')
> else:
> - output = StringIO.StringIO()
> + try:
> + from StringIO import StringIO
> + except ImportError:
> + from io import StringIO
> + output = StringIO()
If it was nit-picking I'd put the py3 'io' import first and the py2
'StringIO' as the fallback, but doesn't honestly matter
>
> logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))
>
> --
> 2.15.1
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [Qemu-block] [PATCH 4/9] iotests: use octal numbers for python3 compatibility, (continued)
- [Qemu-block] [PATCH 5/9] iotests: replace xrange() by range() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 6/9] iotests: replace dict.has_key() by 'in' operator for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 7/9] iotests: replace lambda function by lambda expression for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 8/9] iotests: replace assertEquals() by assertEqual() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 9/9] iotests.py: use io.StringIO with python3, Philippe Mathieu-Daudé, 2017/12/19
- Re: [Qemu-block] [PATCH 0/9] iotests: python3 compatibility, Paolo Bonzini, 2017/12/19