]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix 'Using deprecated class FileType of module argparse'
authorŠtěpán Balážik <stepan@isc.org>
Sat, 21 Feb 2026 10:46:33 +0000 (11:46 +0100)
committerŠtěpán Balážik <stepan@isc.org>
Wed, 25 Feb 2026 12:15:05 +0000 (13:15 +0100)
In preparation for running pylint on more Python code.

bin/tests/system/convert-junit-to-trs.py

index 9675825a50a87b9b4aa4ae55dc34ce2cd0659250..3726e19fb56b370eec7802865a17b1ab1da2744b 100755 (executable)
@@ -7,6 +7,7 @@
 # Convert JUnit pytest output to automake .trs files
 
 import argparse
+from pathlib import Path
 import sys
 from xml.etree import ElementTree
 
@@ -57,12 +58,13 @@ def main():
     )
     parser.add_argument(
         "junit_file",
-        type=argparse.FileType("r", encoding="utf-8"),
+        type=Path,
         help="junit xml result file",
     )
     args = parser.parse_args()
 
-    junit_xml = args.junit_file.read()
+    with args.junit_file.open(encoding="utf-8") as junit_file:
+        junit_xml = junit_file.read()
     sys.exit(junit_to_trs(junit_xml))