Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exclude deprecated options based on RF version #563

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/pabot/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
27 changes: 20 additions & 7 deletions src/pabot/pabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"]:
Expand Down Expand Up @@ -1142,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)
Expand Down