Skip to contentSkip to conversation

iotests: Replace deprecated ConfigParser.readfp()

PATCH In review Kevin Wolf 3 participants 5 messages Nov 13, 2020 – Nov 16, 2020

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 iotests: Replace deprecated ConfigParser.readfp()

iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning changes the output:

nbd-fault-injector.py:230: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.

In fact, readfp() has already been deprecated in Python 3.2 and the replacement has existed since the same version, so we can now unconditionally switch to read_file().

---
 tests/qemu-iotests/nbd-fault-injector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/nbd-fault-injector.py +1 -1
index 78f42c4214..6e11ef89b8 100755
@@ -227,7 +227,7 @@ def parse_config(config):
 def load_rules(filename):
     config = configparser.RawConfigParser()
     with open(filename, 'rt') as f:
-        config.readfp(f, filename)
+        config.read_file(f, filename)
     return parse_config(config)
 
 def open_socket(path):
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kevin Wolf

iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning changes the output:

nbd-fault-injector.py:230: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.

Quoted 8 lines

In fact, readfp() has already been deprecated in Python 3.2 and the replacement has existed since the same version, so we can now unconditionally switch to read_file().

---
 tests/qemu-iotests/nbd-fault-injector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I'm happy to queue this through my NBD tree for -rc2.

Quoted 15 lines
tests/qemu-iotests/nbd-fault-injector.py +1 -1
index 78f42c4214..6e11ef89b8 100755
@@ -227,7 +227,7 @@ def parse_config(config):
 def load_rules(filename):
     config = configparser.RawConfigParser()
     with open(filename, 'rt') as f:
-        config.readfp(f, filename)
+        config.read_file(f, filename)
     return parse_config(config)
 
 def open_socket(path):
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
author
#2 lore raw

Am 13.11.2020 um 14:47 hat Eric Blake geschrieben:

Quoted 11 lines · Kevin Wolf
Quoted 10 lines

iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning changes the output:

nbd-fault-injector.py:230: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.

In fact, readfp() has already been deprecated in Python 3.2 and the replacement has existed since the same version, so we can now unconditionally switch to read_file().

Quoted 8 lines
Quoted 4 lines
---
 tests/qemu-iotests/nbd-fault-injector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I'm happy to queue this through my NBD tree for -rc2.

If you don't have other patches to send, I can take it through my own tree, but if you send a pull request anyway, that's fine, too.

Kevin

#3 lore raw
Quoted 17 lines · Kevin Wolf

Am 13.11.2020 um 14:47 hat Eric Blake geschrieben:

Quoted 16 lines · Kevin Wolf
Quoted 14 lines

iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning changes the output:

nbd-fault-injector.py:230: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.

In fact, readfp() has already been deprecated in Python 3.2 and the replacement has existed since the same version, so we can now unconditionally switch to read_file().

---
 tests/qemu-iotests/nbd-fault-injector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines
Quoted 3 lines

I'm happy to queue this through my NBD tree for -rc2.

If you don't have other patches to send, I can take it through my own tree, but if you send a pull request anyway, that's fine, too.

I've got at least one other NBD patch, and am double-checking my trees and flagged inbox messages to see if there are any other last-minute -rc2 candidates, so I will be sending a Pull Request on Monday.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v1 1/1
#4 lore raw
In reply to Kevin Wolf
Quoted 6 lines · Kevin Wolf

iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning changes the output:

nbd-fault-injector.py:230: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.

Quoted 8 lines

In fact, readfp() has already been deprecated in Python 3.2 and the replacement has existed since the same version, so we can now unconditionally switch to read_file().

---
 tests/qemu-iotests/nbd-fault-injector.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)