diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-07-30 08:52:32 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-07-30 10:50:43 +0200 |
| commit | 74551b389f6aa649e34fa4052757abbf0c9e8cce (patch) | |
| tree | 074a6ae8f195ee4de059c4fdea05a017e3325623 /testing/command.py | |
| parent | fdc842eb5394e162ea33b247462f3f996b608a44 (diff) | |
testrunner: Fix deprecation warning about =argparse.FileType
Open the files directly as advised, fixing:
testing/command.py:170: PendingDeprecationWarning: FileType is deprecated. Simply open files after parsing arguments.
type=argparse.FileType("r"),
testing/command.py:198: PendingDeprecationWarning: FileType is deprecated. Simply open files after parsing arguments.
"filename", type=argparse.FileType("w"), help="write the build dir name into a file"
Pick-to: 6.9 6.8
Task-number: PYSIDE-3147
Change-Id: I78949168309b8939d9dd2db5bedb277b6a679d28
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'testing/command.py')
| -rw-r--r-- | testing/command.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/testing/command.py b/testing/command.py index 6b2a18e62..9ef35ee20 100644 --- a/testing/command.py +++ b/testing/command.py @@ -39,6 +39,7 @@ import argparse import os import sys from collections import OrderedDict +from pathlib import Path from textwrap import dedent from timeit import default_timer as timer @@ -167,7 +168,7 @@ def main(): group.add_argument( "--blacklist", "-b", - type=argparse.FileType("r"), + type=str, default=blacklist_default, help=f"a Qt blacklist file (default: {blacklist_default})", ) @@ -195,7 +196,7 @@ def main(): ) parser_getcwd = subparsers.add_parser("getcwd") parser_getcwd.add_argument( - "filename", type=argparse.FileType("w"), help="write the build dir name into a file" + "filename", type=str, help="write the build dir name into a file" ) parser_getcwd.add_argument( "--buildno", @@ -213,8 +214,8 @@ def main(): sys.exit(1) if args.subparser_name == "getcwd": - print(builds.selected.build_dir, file=args.filename) - print(builds.selected.build_dir, "written to file", args.filename.name) + Path(args.filename).write_text(builds.selected.build_dir + '\n') + print(builds.selected.build_dir, "written to file", args.filename) sys.exit(0) elif args.subparser_name == "test": runs = args.reruns @@ -235,8 +236,7 @@ def main(): sys.exit(1) if args.blacklist: - args.blacklist.close() - bl = BlackList(args.blacklist.name) + bl = BlackList(args.blacklist) else: bl = BlackList(None) if args.environ: |
