From: Štěpán Balážik Date: Sat, 21 Feb 2026 10:46:33 +0000 (+0100) Subject: Fix 'Using deprecated class FileType of module argparse' X-Git-Tag: v9.20.20~5^2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6247cad75664cc9f1276e8c345d50ec3e91b06e;p=thirdparty%2Fbind9.git Fix 'Using deprecated class FileType of module argparse' In preparation for running pylint on more Python code. --- diff --git a/bin/tests/system/convert-junit-to-trs.py b/bin/tests/system/convert-junit-to-trs.py index 9675825a50a..3726e19fb56 100755 --- a/bin/tests/system/convert-junit-to-trs.py +++ b/bin/tests/system/convert-junit-to-trs.py @@ -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))