From: Bjoern Ricks Date: Fri, 9 Jan 2026 11:28:53 +0100 Subject: [PATCH] test: Fix argument parser tests on Python 3.14 Origin: https://github.com/greenbone/greenbone-feed-sync/commit/4170b0d4692993f858c73b9e17744e520f6d6669 In Python 3.14 the way the program name is parsed in the argparser module has changed. See https://github.com/python/cpython/issues/66436 for details. Therefore the tests did break which mock the pre 3.14 parsing of the program name. Fix this behavior by explicitly passing a program name derived from `sys.argv[0]` (which is the default behavior in Python < 3.14). Despite failing tests this had no influence of the tool. Fixes #325 --- greenbone/feed/sync/parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/greenbone/feed/sync/parser.py b/greenbone/feed/sync/parser.py index 05a4239..d236a70 100644 --- a/greenbone/feed/sync/parser.py +++ b/greenbone/feed/sync/parser.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # +import sys from argparse import ArgumentParser, Namespace from pathlib import Path from typing import Any, Optional, Sequence @@ -49,7 +50,7 @@ class CliParser: """ def __init__(self) -> None: - parser = ArgumentParser(add_help=False) + parser = ArgumentParser(prog=Path(sys.argv[0]).name, add_help=False) shtab.add_argument_to(parser) parser.add_argument( "--version",