From a10d0ac60c9bd4c5271a42a57c8c471733fee816 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Wed, 10 Jan 2024 14:24:11 +0100 Subject: [PATCH 1/2] filter arg parsing options based on RF version New RF versions have deprecated some options which result in console warning messages being shown to users --- src/pabot/arguments.py | 24 ++++++++++++++++++------ src/pabot/pabot.py | 14 ++++++++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/pabot/arguments.py b/src/pabot/arguments.py index 47bdea0f..e3cbe730 100644 --- a/src/pabot/arguments.py +++ b/src/pabot/arguments.py @@ -28,21 +28,33 @@ def _processes_count(): # type: () -> int return 2 +def _filter_argument_parser_options(**options): + # Note: auto_pythonpath is deprecated since RobotFramework 5.0, but only + # communicated to users from 6.1 + if ROBOT_VERSION >= "5.0" and "auto_pythonpath" in options: + del options["auto_pythonpath"] + return options + + def parse_args( args, ): # type: (List[str]) -> Tuple[Dict[str, object], List[str], Dict[str, object], Dict[str, object]] args, pabot_args = _parse_pabot_args(args) options, datasources = ArgumentParser( USAGE, - auto_pythonpath=False, - auto_argumentfile=True, - env_options="ROBOT_OPTIONS", + **_filter_argument_parser_options( + auto_pythonpath=False, + auto_argumentfile=True, + env_options="ROBOT_OPTIONS", + ), ).parse_args(args) options_for_subprocesses, sources_without_argfile = ArgumentParser( USAGE, - auto_pythonpath=False, - auto_argumentfile=False, - env_options="ROBOT_OPTIONS", + **_filter_argument_parser_options( + auto_pythonpath=False, + auto_argumentfile=False, + env_options="ROBOT_OPTIONS", + ), ).parse_args(args) if len(datasources) != len(sources_without_argfile): raise DataError( diff --git a/src/pabot/pabot.py b/src/pabot/pabot.py index 8738db20..a554fa1c 100644 --- a/src/pabot/pabot.py +++ b/src/pabot/pabot.py @@ -114,7 +114,11 @@ from robot.utils import PY2, SYSTEM_ENCODING, ArgumentParser, is_unicode from . import pabotlib, __version__ as PABOT_VERSION -from .arguments import parse_args, parse_execution_item_line +from .arguments import ( + parse_args, + parse_execution_item_line, + _filter_argument_parser_options, +) from .clientwrapper import make_order from .execution_items import ( DynamicSuiteItem, @@ -638,9 +642,11 @@ def _options_for_executor( def _modify_options_for_argfile_use(argfile, options, root_name): argfile_opts, _ = ArgumentParser( USAGE, - auto_pythonpath=False, - auto_argumentfile=True, - env_options="ROBOT_OPTIONS", + **_filter_argument_parser_options( + auto_pythonpath=False, + auto_argumentfile=True, + env_options="ROBOT_OPTIONS", + ), ).parse_args(["--argumentfile", argfile]) old_name = options.get("name", root_name) if argfile_opts["name"]: From 2f7fa897de528d3c3c6e90e8742c7993c3c3cf1f Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Wed, 10 Jan 2024 14:25:05 +0100 Subject: [PATCH 2/2] remove usage of included_suites when using newer RF versions included_suites has been deprecated as of RF 6.1 --- src/pabot/pabot.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pabot/pabot.py b/src/pabot/pabot.py index a554fa1c..f0ef5c65 100644 --- a/src/pabot/pabot.py +++ b/src/pabot/pabot.py @@ -1148,9 +1148,16 @@ def generate_suite_names_with_builder(outs_dir, datasources, options): if "pythonpath" in opts: del opts["pythonpath"] settings = RobotSettings(opts) - builder = TestSuiteBuilder( - settings["SuiteNames"], settings.extension, rpa=settings.rpa - ) + + # Note: first argument (included_suites) is deprecated from RobotFramework 6.1 + if ROBOT_VERSION < "6.1": + builder = TestSuiteBuilder( + settings["SuiteNames"], settings.extension, rpa=settings.rpa + ) + else: + builder = TestSuiteBuilder( + included_extensions=settings.extension, rpa=settings.rpa + ) suite = builder.build(*datasources) settings.rpa = builder.rpa suite.configure(**settings.suite_config)