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

Invalid option 'language' with robotframework 5.1a1 #484

Closed
oboehmer opened this issue Jul 15, 2022 · 4 comments
Closed

Invalid option 'language' with robotframework 5.1a1 #484

oboehmer opened this issue Jul 15, 2022 · 4 comments
Labels

Comments

@oboehmer
Copy link
Contributor

oboehmer commented Jul 15, 2022

Robot 5.1 introduces the --language option, and this triggers an error with pabot during rebot processing:

root@0eeacbb92c94:/tmp# cat > test.robot
*** Test Cases ***
Test
    Should be True   1==1
root@0eeacbb92c94:/tmp# pabot test.robot
Storing .pabotsuitenames file
2022-07-15 17:55:16.353458 [PID:431] [0] [ID:0] EXECUTING Test
2022-07-15 17:55:16.758217 [PID:431] [0] [ID:0] PASSED Test in 0.4 seconds
[ 1 tests, 1 passed, 0 failed, 0 skipped.
===================================================
Output:  /tmp/output.xml
ERROR ] Invalid option 'language'.

Try --help for usage information.
Total testing: 0.40 seconds
Elapsed time:  0.52 seconds
root@0eeacbb92c94:/tmp#

root@0eeacbb92c94:/tmp# pabot --version
A parallel executor for Robot Framework test cases.
Version 2.5.3
[...]
Robot Framework 5.1a1 (Python 3.8.10 on linux)

Looks similar to #461 , and the below diff fixes it:

*** pabot.py-	Fri Jul 15 17:57:09 2022
--- pabot.py	Fri Jul 15 17:57:39 2022
***************
*** 1215,1220 ****
--- 1215,1221 ----
          "extension",
          "listener",
          "loglevel",
+         "language",
          "maxassignlength",
          "maxerrorlines",
          "monitorcolors",

extending this list doesn't look to be a sustainable approach ;-)

@mkorpela
Copy link
Owner

Thanks for the report!

@mkorpela mkorpela added the bug label Jul 16, 2022
@oboehmer
Copy link
Contributor Author

Wonder if something like this would work for older robot versions too, @mkorpela ?

***************
*** 98,104 ****
  from robot import __version__ as ROBOT_VERSION
  from robot import rebot
  from robot.api import ExecutionResult
! from robot.conf import RobotSettings
  from robot.errors import DataError, Information
  from robot.libraries.Remote import Remote
  from robot.model import ModelModifier
--- 98,104 ----
  from robot import __version__ as ROBOT_VERSION
  from robot import rebot
  from robot.api import ExecutionResult
! from robot.conf import RobotSettings, RebotSettings
  from robot.errors import DataError, Information
  from robot.libraries.Remote import Remote
  from robot.model import ModelModifier
***************
*** 1193,1235 ****


  def _options_for_rebot(options, start_time_string, end_time_string):
!     rebot_options = options.copy()
      rebot_options["starttime"] = start_time_string
      rebot_options["endtime"] = end_time_string
-     rebot_options["monitorcolors"] = "off"
      rebot_options["suite"] = []
      rebot_options["test"] = []
      rebot_options["exclude"] = []
      rebot_options["include"] = []
      if ROBOT_VERSION >= "2.8":
          options["monitormarkers"] = "off"
-     for key in [
-         "console",
-         "consolemarkers",
-         "consolewidth",
-         "debugfile",
-         "dotted",
-         "dryrun",
-         "exitonerror",
-         "exitonfailure",
-         "extension",
-         "listener",
-         "loglevel",
-         "maxassignlength",
-         "maxerrorlines",
-         "monitorcolors",
-         "prerunmodifier",
-         "quiet",
-         "randomize",
-         "runemptysuite",
-         "skip",
-         "skiponfailure",
-         "skipteardownonexit",
-         "variable",
-         "variablefile",
-     ]:
-         if key in rebot_options:
-             del rebot_options[key]
      return rebot_options


--- 1193,1208 ----


  def _options_for_rebot(options, start_time_string, end_time_string):
!     valid_rebot_options = [v[0] for v in RebotSettings()._cli_opts.values()]
!     rebot_options = {k: options[k] for k in options if k in valid_rebot_options}
      rebot_options["starttime"] = start_time_string
      rebot_options["endtime"] = end_time_string
      rebot_options["suite"] = []
      rebot_options["test"] = []
      rebot_options["exclude"] = []
      rebot_options["include"] = []
      if ROBOT_VERSION >= "2.8":
          options["monitormarkers"] = "off"
      return rebot_options

@mkorpela
Copy link
Owner

Hey,
Your absolutely correct. The current mechanism is a bit bad but the data of what is only for robot and not for rebot has been restricted lately.

@mkorpela
Copy link
Owner

Fixed in 2.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants