diff --git a/.vscode/launch.json b/.vscode/launch.json index 515f0a354..a044a2ded 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -47,6 +47,9 @@ // "env": { // "ROBOTCODE_COLOR": "1", // }, + "env": { + "CMD_VAR_LONG": "long", + }, "args": [ "--verbose", "--dry", @@ -63,8 +66,9 @@ // "list", // "--format", // "toml" - "rebot", - + "profiles", + "show", + "--no-evaluate" ] }, { diff --git a/.vscodeignore b/.vscodeignore index ab00fda6e..df1d9e0a5 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -46,9 +46,13 @@ playground coverage.xml .python-version +# mkdocs +docs +overrides +site + # others scripts -doc **/.robotcode_cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 21a1ccf62..a6cf18438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to the "robotcode" extension will be documented in this file +## v0.32.0 (2023-04-05) +### Feature +* Allow expression for str options, better handling of tag:, name: options ([`d037ddb`](https://github.com/d-biehl/robotcode/commit/d037ddbd9d44ccbb501af3854cf8a7d7df607ddd)) +* Add command for robots _testdoc_ ([`dd6d758`](https://github.com/d-biehl/robotcode/commit/dd6d7583f5075b35823b83b8a7aa828507904013)) + ## v0.31.0 (2023-03-30) ### Feature * Profiles can now be enabled or disabled, also with a condition. Profiles can now also be selected with a wildcard pattern. ([`4282f02`](https://github.com/d-biehl/robotcode/commit/4282f02bab4b483d74d486e983ec9a1f606fd3d7)) diff --git a/etc/robot.toml.json b/etc/robot.toml.json index 2dd6fe8ee..4c77c1a4e 100644 --- a/etc/robot.toml.json +++ b/etc/robot.toml.json @@ -8,7 +8,7 @@ "definitions": { "Condition": { "additionalProperties": false, - "description": "Condition(if_: 'str')", + "description": "Condition to evaluate.", "properties": { "if": { "description": "Condition to evaluate. This must be a Python \"eval\" expression.\nFor security reasons, only certain expressions and functions are allowed.\n\nExamples:\n```toml\nif = \"re.match(r'^\\d+$', environ.get('TEST_VAR', ''))\"\nif = \"platform.system() == 'Linux'\"\n```\n", @@ -24,7 +24,7 @@ }, "LibDocProfile": { "additionalProperties": false, - "description": "LibDocProfile(extra_python_path: 'Optional[List[str]]' = None, doc_format: \"Optional[Literal['ROBOT', 'HTML', 'TEXT', 'REST']]\" = None, format: \"Optional[Literal['HTML', 'XML', 'JSON', 'LIBSPEC']]\" = None, name: 'Optional[str]' = None, python_path: 'Optional[List[str]]' = None, quiet: 'Union[bool, Flag, None]' = None, spec_doc_format: \"Optional[Literal['RAW', 'HTML']]\" = None, theme: \"Optional[Literal['DARK', 'LIGHT', 'NONE']]\" = None)", + "description": "Profile for _libdoc_ command.", "properties": { "doc-format": { "description": "Specifies the source documentation format. Possible\nvalues are Robot Framework's documentation format,\nHTML, plain text, and reStructuredText. The default\nvalue can be specified in library source code and\nthe initial default value is ROBOT.\n\n---\ncorresponds to the `-F --docformat ROBOT|HTML|TEXT|REST` option of _robot_\n", @@ -44,7 +44,14 @@ "default": null, "description": "Appends entries to the --pythonpath option.\n\n---\n\nAdditional locations where to search for libraries\nand resources.\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra python path", "type": [ @@ -67,19 +74,33 @@ ] }, "name": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Sets the name of the documented library or resource.\n\n---\ncorresponds to the `-n --name name` option of _robot_\n", - "title": "Name", - "type": [ - "string", - "null" - ] + "title": "Name" }, "python-path": { "default": null, "description": "Additional locations where to search for libraries\nand resources.\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Python path", "type": [ @@ -137,9 +158,25 @@ "title": "LibDocProfile", "type": "object" }, + "NamePattern": { + "additionalProperties": false, + "description": "Name pattern to match.", + "properties": { + "name": { + "description": "Name pattern to match. This is a glob pattern, where ``*`` matches any number of characters\n", + "title": "Name", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "NamePattern", + "type": "object" + }, "RebotProfile": { "additionalProperties": false, - "description": "RebotProfile(extra_excludes: 'Optional[List[str]]' = None, extra_expand_keywords: \"Optional[List[Union[str, Literal['name:', 'tag:']]]]\" = None, extra_flatten_keywords: \"Optional[List[Union[str, Literal['for', 'while', 'iteration', 'name:', 'tag:']]]]\" = None, extra_includes: 'Optional[List[str]]' = None, extra_metadata: 'Optional[Dict[str, str]]' = None, extra_pre_rebot_modifiers: 'Optional[Dict[str, List[str]]]' = None, extra_python_path: 'Optional[List[str]]' = None, extra_remove_keywords: \"Optional[List[Union[str, Literal['all', 'passed', 'for', 'wuks', 'name:', 'tag:']]]]\" = None, extra_set_tag: 'Optional[List[str]]' = None, extra_suites: 'Optional[List[str]]' = None, extra_tag_doc: 'Optional[Dict[str, str]]' = None, extra_tag_stat_combine: 'Optional[Dict[str, str]]' = None, extra_tag_stat_exclude: 'Optional[List[str]]' = None, extra_tag_stat_include: 'Optional[List[str]]' = None, extra_tag_stat_link: 'Optional[Dict[str, str]]' = None, extra_tasks: 'Optional[List[str]]' = None, extra_tests: 'Optional[List[str]]' = None, console_colors: \"Optional[Literal['auto', 'on', 'ansi', 'off']]\" = None, doc: 'Optional[str]' = None, excludes: 'Optional[List[str]]' = None, expand_keywords: \"Optional[List[Union[str, Literal['name:', 'tag:']]]]\" = None, flatten_keywords: \"Optional[List[Union[str, Literal['for', 'while', 'iteration', 'name:', 'tag:']]]]\" = None, includes: 'Optional[List[str]]' = None, log: 'Optional[str]' = None, log_title: 'Optional[str]' = None, metadata: 'Optional[Dict[str, str]]' = None, name: 'Optional[str]' = None, no_status_rc: 'Union[bool, Flag, None]' = None, output_dir: 'Optional[str]' = None, pre_rebot_modifiers: 'Optional[Dict[str, List[str]]]' = None, python_path: 'Optional[List[str]]' = None, remove_keywords: \"Optional[List[Union[str, Literal['all', 'passed', 'for', 'wuks', 'name:', 'tag:']]]]\" = None, report: 'Optional[str]' = None, report_background: 'Optional[str]' = None, report_title: 'Optional[str]' = None, rpa: 'Union[bool, Flag, None]' = None, set_tag: 'Optional[List[str]]' = None, split_log: 'Union[bool, Flag, None]' = None, suites: 'Optional[List[str]]' = None, suite_stat_level: 'Optional[int]' = None, tag_doc: 'Optional[Dict[str, str]]' = None, tag_stat_combine: 'Optional[Dict[str, str]]' = None, tag_stat_exclude: 'Optional[List[str]]' = None, tag_stat_include: 'Optional[List[str]]' = None, tag_stat_link: 'Optional[Dict[str, str]]' = None, tasks: 'Optional[List[str]]' = None, tests: 'Optional[List[str]]' = None, timestamp_outputs: 'Union[bool, Flag, None]' = None, xunit: 'Optional[str]' = None, end_time: 'Optional[str]' = None, log_level: 'Optional[str]' = None, merge: 'Union[bool, Flag, None]' = None, output: 'Optional[str]' = None, process_empty_suite: 'Union[bool, Flag, None]' = None, start_time: 'Optional[str]' = None)", + "description": "Profile for _rebot_ command.", "properties": { "console-colors": { "description": "Use colors on console output or not.\nauto: use colors when output not redirected (default)\non: always use colors\nansi: like `on` but use ANSI colors also on Windows\noff: disable colors altogether\n\n---\ncorresponds to the `-C --consolecolors auto|on|ansi|off` option of _robot_\n", @@ -156,28 +193,49 @@ ] }, "doc": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the documentation of the top level suite.\nSimple formatting is supported (e.g. *bold*). If the\ndocumentation contains spaces, it must be quoted.\nIf the value is path to an existing file, actual\ndocumentation is read from that file.\n\nExamples:\n\n```\n--doc \"Very *good* example\"\n--doc doc_from_file.txt\n```\n\n---\ncorresponds to the `-D --doc documentation` option of _robot_\n", - "title": "Doc", - "type": [ - "string", - "null" - ] + "title": "Doc" }, "end-time": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Same as --starttime but for end time. If both options\nare used, elapsed time of the suite is calculated\nbased on them. For combined suites, it is otherwise\ncalculated by adding elapsed times of the combined\nsuites together.\n\n---\ncorresponds to the `--endtime timestamp` option of _robot_\n", - "title": "End time", - "type": [ - "string", - "null" - ] + "title": "End time" }, "excludes": { "default": null, "description": "Select test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Excludes", "type": [ @@ -186,18 +244,15 @@ ] }, "expand-keywords": { + "default": null, "description": "Matching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -211,7 +266,14 @@ "default": null, "description": "Appends entries to the --exclude option.\n\n---\n\nSelect test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra excludes", "type": [ @@ -220,18 +282,15 @@ ] }, "extra-expand-keywords": { + "default": null, "description": "Appends entries to the --expandkeywords option.\n\n---\n\nMatching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -252,11 +311,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -270,7 +333,14 @@ "default": null, "description": "Appends entries to the --include option.\n\n---\n\nSelect tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra includes", "type": [ @@ -280,7 +350,14 @@ }, "extra-metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --metadata option.\n\n---\n\nSet metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -293,7 +370,14 @@ "extra-pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -309,7 +393,14 @@ "default": null, "description": "Appends entries to the --pythonpath option.\n\n---\n\nAdditional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra python path", "type": [ @@ -321,19 +412,20 @@ "description": "Appends entries to the --removekeywords option.\n\n---\n\nRemove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -347,7 +439,14 @@ "default": null, "description": "Appends entries to the --settag option.\n\n---\n\nSets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra set tag", "type": [ @@ -359,7 +458,14 @@ "default": null, "description": "Appends entries to the --suite option.\n\n---\n\nSelect suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra suites", "type": [ @@ -369,7 +475,14 @@ }, "extra-tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagdoc option.\n\n---\n\nAdd documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -380,14 +493,24 @@ ] }, "extra-tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Appends entries to the --tagstatcombine option.\n\n---\n\nCreate combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Extra tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -395,7 +518,14 @@ "default": null, "description": "Appends entries to the --tagstatexclude option.\n\n---\n\nExclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat exclude", "type": [ @@ -407,7 +537,14 @@ "default": null, "description": "Appends entries to the --tagstatinclude option.\n\n---\n\nInclude only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat include", "type": [ @@ -417,7 +554,14 @@ }, "extra-tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagstatlink option.\n\n---\n\nAdd external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -431,7 +575,14 @@ "default": null, "description": "Appends entries to the --task option.\n\n---\n\nAlias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tasks", "type": [ @@ -443,7 +594,14 @@ "default": null, "description": "Appends entries to the --test option.\n\n---\n\nSelect tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tests", "type": [ @@ -462,11 +620,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -480,7 +642,14 @@ "default": null, "description": "Select tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Includes", "type": [ @@ -489,56 +658,84 @@ ] }, "log": { - "default": null, - "description": "HTML log file. Can be disabled by giving a special\nvalue `NONE`. Default: log.html\n\nExamples:\n\n```\n`--log mylog.html`, `-l NONE`\n```\n\n---\ncorresponds to the `-l --log file` option of _robot_\n", - "title": "Log", - "type": [ - "string", - "null" - ] - }, - "log-level": { - "default": null, - "description": "Threshold for selecting messages. Available levels:\nTRACE (default), DEBUG, INFO, WARN, NONE (no msgs).\nUse syntax `LOGLEVEL:DEFAULT` to define the default\nvisible log level in log files.\n\nExamples:\n\n```\n--loglevel DEBUG\n--loglevel DEBUG:INFO\n```\n\n---\ncorresponds to the `-L --loglevel level` option of _robot_\n", - "title": "Log level", - "type": [ - "string", - "null" - ] - }, - "log-title": { - "default": null, - "description": "Title for the generated log file. The default title\nis ` Log`.\n\n---\ncorresponds to the `--logtitle title` option of _robot_\n", - "title": "Log title", - "type": [ - "string", - "null" - ] - }, - "merge": { "anyOf": [ { - "type": "boolean" + "type": "string" }, { - "enum": [ - "on", - "off", - "default" - ], - "type": "string" + "$ref": "#/definitions/StringExpression" }, { "type": "null" } ], "default": null, - "description": "When combining results, merge outputs together\ninstead of putting them under a new top level suite.\nExample: rebot --merge orig.xml rerun.xml\n\n---\ncorresponds to the `-R --merge` option of _robot_\n", - "title": "Merge" + "description": "HTML log file. Can be disabled by giving a special\nvalue `NONE`. Default: log.html\n\nExamples:\n\n```\n`--log mylog.html`, `-l NONE`\n```\n\n---\ncorresponds to the `-l --log file` option of _robot_\n", + "title": "Log" + }, + "log-level": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Threshold for selecting messages. Available levels:\nTRACE (default), DEBUG, INFO, WARN, NONE (no msgs).\nUse syntax `LOGLEVEL:DEFAULT` to define the default\nvisible log level in log files.\n\nExamples:\n\n```\n--loglevel DEBUG\n--loglevel DEBUG:INFO\n```\n\n---\ncorresponds to the `-L --loglevel level` option of _robot_\n", + "title": "Log level" + }, + "log-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Title for the generated log file. The default title\nis ` Log`.\n\n---\ncorresponds to the `--logtitle title` option of _robot_\n", + "title": "Log title" + }, + "merge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "enum": [ + "on", + "off", + "default" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "When combining results, merge outputs together\ninstead of putting them under a new top level suite.\nExample: rebot --merge orig.xml rerun.xml\n\n---\ncorresponds to the `-R --merge` option of _robot_\n", + "title": "Merge" }, "metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Set metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -549,13 +746,20 @@ ] }, "name": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the name of the top level suite. By default the\nname is created based on the executed file or\ndirectory.\n\n---\ncorresponds to the `-N --name name` option of _robot_\n", - "title": "Name", - "type": [ - "string", - "null" - ] + "title": "Name" }, "no-status-rc": { "anyOf": [ @@ -579,27 +783,48 @@ "title": "No status rc" }, "output": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "XML output file. Not created unless this option is\nspecified. Given path, similarly as paths given to\n--log, --report and --xunit, is relative to\n--outputdir unless given as an absolute path.\n\n---\ncorresponds to the `-o --output file` option of _robot_\n", - "title": "Output", - "type": [ - "string", - "null" - ] + "title": "Output" }, "output-dir": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Where to create output files. The default is the\ndirectory where tests are run from and the given path\nis considered relative to that unless it is absolute.\n\n---\ncorresponds to the `-d --outputdir dir` option of _robot_\n", - "title": "Output dir", - "type": [ - "string", - "null" - ] + "title": "Output dir" }, "pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -636,7 +861,14 @@ "default": null, "description": "Additional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Python path", "type": [ @@ -648,19 +880,20 @@ "description": "Remove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -671,31 +904,52 @@ ] }, "report": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "HTML report file. Can be disabled with `NONE`\nsimilarly as --log. Default: report.html\n\n---\ncorresponds to the `-r --report file` option of _robot_\n", - "title": "Report", - "type": [ - "string", - "null" - ] + "title": "Report" }, "report-background": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Background colors to use in the report file.\nGiven in format `passed:failed:skipped` where the\n`:skipped` part can be omitted. Both color names and\ncodes work.\n\nExamples:\n\n```\n--reportbackground green:red:yellow\n--reportbackground #00E:#E00\n```\n\n---\ncorresponds to the `--reportbackground colors` option of _robot_\n", - "title": "Report background", - "type": [ - "string", - "null" - ] + "title": "Report background" }, "report-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Title for the generated report file. The default\ntitle is ` Report`.\n\n---\ncorresponds to the `--reporttitle title` option of _robot_\n", - "title": "Report title", - "type": [ - "string", - "null" - ] + "title": "Report title" }, "rpa": { "anyOf": [ @@ -722,7 +976,14 @@ "default": null, "description": "Sets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Set tag", "type": [ @@ -752,13 +1013,20 @@ "title": "Split log" }, "start-time": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set execution start time. Timestamp must be given in\nformat `2007-10-01 15:12:42.268` where all separators\nare optional (e.g. `20071001151242268` is ok too) and\nparts from milliseconds to hours can be omitted if\nthey are zero (e.g. `2007-10-01`). This can be used\nto override start time of a single suite or to set\nstart time for a combined suite, which would\notherwise be `N/A`.\n\n---\ncorresponds to the `--starttime timestamp` option of _robot_\n", - "title": "Start time", - "type": [ - "string", - "null" - ] + "title": "Start time" }, "suite-stat-level": { "default": null, @@ -773,7 +1041,14 @@ "default": null, "description": "Select suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Suites", "type": [ @@ -783,7 +1058,14 @@ }, "tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -794,14 +1076,24 @@ ] }, "tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Create combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -809,7 +1101,14 @@ "default": null, "description": "Exclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat exclude", "type": [ @@ -821,7 +1120,14 @@ "default": null, "description": "Include only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat include", "type": [ @@ -831,7 +1137,14 @@ }, "tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -845,7 +1158,14 @@ "default": null, "description": "Alias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tasks", "type": [ @@ -857,7 +1177,14 @@ "default": null, "description": "Select tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tests", "type": [ @@ -887,13 +1214,20 @@ "title": "Timestamp outputs" }, "xunit": { - "default": null, - "description": "xUnit compatible result file. Not created unless this\noption is specified.\n\n---\ncorresponds to the `-x --xunit file` option of _robot_\n", - "title": "Xunit", - "type": [ - "string", - "null" - ] + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "xUnit compatible result file. Not created unless this\noption is specified.\n\n---\ncorresponds to the `-x --xunit file` option of _robot_\n", + "title": "Xunit" } }, "title": "RebotProfile", @@ -967,15 +1301,22 @@ ] }, "debug-file": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Debug file written during execution. Not created\nunless this option is specified.\n\n---\ncorresponds to the `-b --debugfile file` option of _robot_\n", - "title": "Debug file", - "type": [ - "string", - "null" - ] + "title": "Debug file" }, - "default-profile": { + "default-profiles": { "anyOf": [ { "type": "string" @@ -991,17 +1332,24 @@ } ], "default": null, - "description": "Selects the Default profile if no profile is given at command line.\n\nExamples:\n```toml\ndefault_profile = \"default\"\n```\n\n```toml\ndefault_profile = [\"default\", \"Firefox\"]\n```\n", - "title": "Default profile" + "description": "Selects the Default profile if no profile is given at command line.\n\nExamples:\n```toml\ndefault_profiles = \"default\"\n```\n\n```toml\ndefault_profiles = [\"default\", \"Firefox\"]\n```\n", + "title": "Default profiles" }, "doc": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the documentation of the top level suite.\nSimple formatting is supported (e.g. *bold*). If the\ndocumentation contains spaces, it must be quoted.\nIf the value is path to an existing file, actual\ndocumentation is read from that file.\n\nExamples:\n\n```\n--doc \"Very *good* example\"\n--doc doc_from_file.txt\n```\n\n---\ncorresponds to the `-D --doc documentation` option of _robot_\n", - "title": "Doc", - "type": [ - "string", - "null" - ] + "title": "Doc" }, "dotted": { "anyOf": [ @@ -1061,7 +1409,14 @@ "default": null, "description": "Select test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Excludes", "type": [ @@ -1112,18 +1467,15 @@ "title": "Exit on failure" }, "expand-keywords": { + "default": null, "description": "Matching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -1134,13 +1486,20 @@ ] }, "extensions": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Parse only files with this extension when executing\na directory. Has no effect when running individual\nfiles or when using resource files. If more than one\nextension is needed, separate them with a colon.\n\nExamples:\n\n```\n`--extension txt`, `--extension robot:txt`\n```\n\n\nOnly `*.robot` files are parsed by default.\n\n---\ncorresponds to the `-F --extension value` option of _robot_\n", - "title": "Extensions", - "type": [ - "string", - "null" - ] + "title": "Extensions" }, "extra-args": { "default": null, @@ -1170,7 +1529,14 @@ "default": null, "description": "Appends entries to the --exclude option.\n\n---\n\nSelect test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra excludes", "type": [ @@ -1179,18 +1545,15 @@ ] }, "extra-expand-keywords": { + "default": null, "description": "Appends entries to the --expandkeywords option.\n\n---\n\nMatching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -1211,11 +1574,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -1229,7 +1596,14 @@ "default": null, "description": "Appends entries to the --include option.\n\n---\n\nSelect tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra includes", "type": [ @@ -1241,7 +1615,14 @@ "default": null, "description": "Appends entries to the --language option.\n\n---\n\nActivate localization. `lang` can be a name or a code\nof a built-in language, or a path or a module name of\na custom language file.\n\n---\ncorresponds to the `--language lang *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra languages", "type": [ @@ -1252,7 +1633,14 @@ "extra-listeners": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1266,7 +1654,14 @@ }, "extra-metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --metadata option.\n\n---\n\nSet metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -1298,7 +1693,14 @@ "extra-pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1313,7 +1715,14 @@ "extra-pre-run-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1340,7 +1749,14 @@ "default": null, "description": "Appends entries to the --pythonpath option.\n\n---\n\nAdditional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra python path", "type": [ @@ -1352,19 +1768,20 @@ "description": "Appends entries to the --removekeywords option.\n\n---\n\nRemove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -1378,7 +1795,14 @@ "default": null, "description": "Appends entries to the --settag option.\n\n---\n\nSets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra set tag", "type": [ @@ -1390,7 +1814,14 @@ "default": null, "description": "Appends entries to the --skip option.\n\n---\n\nTests having given tag will be skipped. Tag can be\na pattern.\n\n---\ncorresponds to the `--skip tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra skip", "type": [ @@ -1402,7 +1833,14 @@ "default": null, "description": "Appends entries to the --skiponfailure option.\n\n---\n\nTests having given tag will be skipped if they fail.\nTag can be a pattern\n\n---\ncorresponds to the `--skiponfailure tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra skip on failure", "type": [ @@ -1414,7 +1852,14 @@ "default": null, "description": "Appends entries to the --suite option.\n\n---\n\nSelect suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra suites", "type": [ @@ -1424,7 +1869,14 @@ }, "extra-tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagdoc option.\n\n---\n\nAdd documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -1435,14 +1887,24 @@ ] }, "extra-tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Appends entries to the --tagstatcombine option.\n\n---\n\nCreate combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Extra tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -1450,7 +1912,14 @@ "default": null, "description": "Appends entries to the --tagstatexclude option.\n\n---\n\nExclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat exclude", "type": [ @@ -1462,7 +1931,14 @@ "default": null, "description": "Appends entries to the --tagstatinclude option.\n\n---\n\nInclude only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat include", "type": [ @@ -1472,7 +1948,14 @@ }, "extra-tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagstatlink option.\n\n---\n\nAdd external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -1486,7 +1969,14 @@ "default": null, "description": "Appends entries to the --task option.\n\n---\n\nAlias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tasks", "type": [ @@ -1498,7 +1988,14 @@ "default": null, "description": "Appends entries to the --test option.\n\n---\n\nSelect tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tests", "type": [ @@ -1510,7 +2007,14 @@ "default": null, "description": "Appends entries to the --variablefile option.\n\n---\n\nPython or YAML file file to read variables from.\nPossible arguments to the variable file can be given\nafter the path using colon or semicolon as separator.\n\nExamples:\n\n```\n--variablefile path/vars.yaml\n--variablefile environment.py:testing\n```\n\n---\ncorresponds to the `-V --variablefile path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra variable files", "type": [ @@ -1520,7 +2024,14 @@ }, "extra-variables": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --variable option.\n\n---\n\nSet variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`. See --variablefile for a more\npowerful variable setting mechanism.\n\nExamples:\n\n```\n--variable str:Hello => ${str} = `Hello`\n-v hi:Hi_World -E space:_ => ${hi} = `Hi World`\n-v x: -v y:42 => ${x} = ``, ${y} = `42`\n```\n\n---\ncorresponds to the `-v --variable name:value *` option of _robot_\n", @@ -1541,11 +2052,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -1559,7 +2074,14 @@ "default": null, "description": "Select tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Includes", "type": [ @@ -1571,13 +2093,20 @@ "default": null, "description": "Activate localization. `lang` can be a name or a code\nof a built-in language, or a path or a module name of\na custom language file.\n\n---\ncorresponds to the `--language lang *` option of _robot_\n", "items": { - "type": "string" - }, - "title": "Languages", - "type": [ - "array", - "null" - ] + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Languages", + "type": [ + "array", + "null" + ] }, "libdoc": { "anyOf": [ @@ -1594,7 +2123,14 @@ "listeners": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1607,31 +2143,52 @@ ] }, "log": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "HTML log file. Can be disabled by giving a special\nvalue `NONE`. Default: log.html\n\nExamples:\n\n```\n`--log mylog.html`, `-l NONE`\n```\n\n---\ncorresponds to the `-l --log file` option of _robot_\n", - "title": "Log", - "type": [ - "string", - "null" - ] + "title": "Log" }, "log-level": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Threshold level for logging. Available levels: TRACE,\nDEBUG, INFO (default), WARN, NONE (no logging). Use\nsyntax `LOGLEVEL:DEFAULT` to define the default\nvisible log level in log files.\n\nExamples:\n\n```\n--loglevel DEBUG\n--loglevel DEBUG:INFO\n```\n\n---\ncorresponds to the `-L --loglevel level` option of _robot_\n", - "title": "Log level", - "type": [ - "string", - "null" - ] + "title": "Log level" }, "log-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Title for the generated log file. The default title\nis ` Log`.\n\n---\ncorresponds to the `--logtitle title` option of _robot_\n", - "title": "Log title", - "type": [ - "string", - "null" - ] + "title": "Log title" }, "max-assign-length": { "default": null, @@ -1653,7 +2210,14 @@ }, "metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Set metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -1664,13 +2228,20 @@ ] }, "name": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the name of the top level suite. By default the\nname is created based on the executed file or\ndirectory.\n\n---\ncorresponds to the `-N --name name` option of _robot_\n", - "title": "Name", - "type": [ - "string", - "null" - ] + "title": "Name" }, "no-status-rc": { "anyOf": [ @@ -1694,22 +2265,36 @@ "title": "No status rc" }, "output": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "XML output file. Given path, similarly as paths given\nto --log, --report, --xunit, and --debugfile, is\nrelative to --outputdir unless given as an absolute\npath. Other output files are created based on XML\noutput files after the test execution and XML outputs\ncan also be further processed with Rebot tool. Can be\ndisabled by giving a special value `NONE`.\nDefault: output.xml\n\n---\ncorresponds to the `-o --output file` option of _robot_\n", - "title": "Output", - "type": [ - "string", - "null" - ] + "title": "Output" }, "output-dir": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Where to create output files. The default is the\ndirectory where tests are run from and the given path\nis considered relative to that unless it is absolute.\n\n---\ncorresponds to the `-d --outputdir dir` option of _robot_\n", - "title": "Output dir", - "type": [ - "string", - "null" - ] + "title": "Output dir" }, "paths": { "anyOf": [ @@ -1733,7 +2318,14 @@ "pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1748,7 +2340,14 @@ "pre-run-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -1775,7 +2374,14 @@ "default": null, "description": "Additional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Python path", "type": [ @@ -1826,22 +2432,36 @@ "title": "Randomize" }, "re-run-failed": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Select failed tests from an earlier output file to be\nre-executed. Equivalent to selecting same tests\nindividually using --test.\n\n---\ncorresponds to the `-R --rerunfailed output` option of _robot_\n", - "title": "Re run failed", - "type": [ - "string", - "null" - ] + "title": "Re run failed" }, "re-run-failed-suites": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Select failed suites from an earlier output\nfile to be re-executed.\n\n---\ncorresponds to the `-S --rerunfailedsuites output` option of _robot_\n", - "title": "Re run failed suites", - "type": [ - "string", - "null" - ] + "title": "Re run failed suites" }, "rebot": { "anyOf": [ @@ -1859,19 +2479,20 @@ "description": "Remove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -1882,31 +2503,52 @@ ] }, "report": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "HTML report file. Can be disabled with `NONE`\nsimilarly as --log. Default: report.html\n\n---\ncorresponds to the `-r --report file` option of _robot_\n", - "title": "Report", - "type": [ - "string", - "null" - ] + "title": "Report" }, "report-background": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Background colors to use in the report file.\nGiven in format `passed:failed:skipped` where the\n`:skipped` part can be omitted. Both color names and\ncodes work.\n\nExamples:\n\n```\n--reportbackground green:red:yellow\n--reportbackground #00E:#E00\n```\n\n---\ncorresponds to the `--reportbackground colors` option of _robot_\n", - "title": "Report background", - "type": [ - "string", - "null" - ] + "title": "Report background" }, "report-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Title for the generated report file. The default\ntitle is ` Report`.\n\n---\ncorresponds to the `--reporttitle title` option of _robot_\n", - "title": "Report title", - "type": [ - "string", - "null" - ] + "title": "Report title" }, "rpa": { "anyOf": [ @@ -1954,7 +2596,14 @@ "default": null, "description": "Sets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Set tag", "type": [ @@ -1966,7 +2615,14 @@ "default": null, "description": "Tests having given tag will be skipped. Tag can be\na pattern.\n\n---\ncorresponds to the `--skip tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Skip", "type": [ @@ -1978,7 +2634,14 @@ "default": null, "description": "Tests having given tag will be skipped if they fail.\nTag can be a pattern\n\n---\ncorresponds to the `--skiponfailure tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Skip on failure", "type": [ @@ -2041,7 +2704,14 @@ "default": null, "description": "Select suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Suites", "type": [ @@ -2051,7 +2721,14 @@ }, "tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -2062,14 +2739,24 @@ ] }, "tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Create combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -2077,7 +2764,14 @@ "default": null, "description": "Exclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat exclude", "type": [ @@ -2089,7 +2783,14 @@ "default": null, "description": "Include only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat include", "type": [ @@ -2099,7 +2800,14 @@ }, "tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -2113,7 +2821,14 @@ "default": null, "description": "Alias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tasks", "type": [ @@ -2121,11 +2836,31 @@ "null" ] }, + "testdoc": { + "anyOf": [ + { + "$ref": "#/definitions/TestDocProfile" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Options to be passed to _testdoc_.\n", + "title": "Testdoc" + }, "tests": { "default": null, "description": "Select tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tests", "type": [ @@ -2163,7 +2898,14 @@ "default": null, "description": "Python or YAML file file to read variables from.\nPossible arguments to the variable file can be given\nafter the path using colon or semicolon as separator.\n\nExamples:\n\n```\n--variablefile path/vars.yaml\n--variablefile environment.py:testing\n```\n\n---\ncorresponds to the `-V --variablefile path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Variable files", "type": [ @@ -2173,7 +2915,14 @@ }, "variables": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`. See --variablefile for a more\npowerful variable setting mechanism.\n\nExamples:\n\n```\n--variable str:Hello => ${str} = `Hello`\n-v hi:Hi_World -E space:_ => ${hi} = `Hi World`\n-v x: -v y:42 => ${x} = ``, ${y} = `42`\n```\n\n---\ncorresponds to the `-v --variable name:value *` option of _robot_\n", @@ -2184,13 +2933,20 @@ ] }, "xunit": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "xUnit compatible result file. Not created unless this\noption is specified.\n\n---\ncorresponds to the `-x --xunit file` option of _robot_\n", - "title": "Xunit", - "type": [ - "string", - "null" - ] + "title": "Xunit" } }, "title": "RobotConfig", @@ -2264,13 +3020,20 @@ ] }, "debug-file": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Debug file written during execution. Not created\nunless this option is specified.\n\n---\ncorresponds to the `-b --debugfile file` option of _robot_\n", - "title": "Debug file", - "type": [ - "string", - "null" - ] + "title": "Debug file" }, "description": { "default": null, @@ -2291,13 +3054,20 @@ ] }, "doc": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the documentation of the top level suite.\nSimple formatting is supported (e.g. *bold*). If the\ndocumentation contains spaces, it must be quoted.\nIf the value is path to an existing file, actual\ndocumentation is read from that file.\n\nExamples:\n\n```\n--doc \"Very *good* example\"\n--doc doc_from_file.txt\n```\n\n---\ncorresponds to the `-D --doc documentation` option of _robot_\n", - "title": "Doc", - "type": [ - "string", - "null" - ] + "title": "Doc" }, "dotted": { "anyOf": [ @@ -2354,7 +3124,7 @@ } ], "default": null, - "description": "If enabled the profile is used. You can also use and `if` condition\nto calculate the enabled state.\n\nExamples:\n```toml\n# alway disabled\nenabled = false\n```\n\n```toml\n# enabled if TEST_VAR is set\nenabled = { if = 'env.get(\"CI\") == \"true\"' }\n```\n", + "description": "If enabled the profile is used. You can also use and `if` condition\nto calculate the enabled state.\n\nExamples:\n```toml\n# alway disabled\nenabled = false\n```\n\n```toml\n# enabled if TEST_VAR is set\nenabled = { if = 'environ.get(\"CI\") == \"true\"' }\n```\n", "title": "Enabled" }, "env": { @@ -2373,7 +3143,14 @@ "default": null, "description": "Select test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Excludes", "type": [ @@ -2424,18 +3201,15 @@ "title": "Exit on failure" }, "expand-keywords": { + "default": null, "description": "Matching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -2446,13 +3220,20 @@ ] }, "extensions": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Parse only files with this extension when executing\na directory. Has no effect when running individual\nfiles or when using resource files. If more than one\nextension is needed, separate them with a colon.\n\nExamples:\n\n```\n`--extension txt`, `--extension robot:txt`\n```\n\n\nOnly `*.robot` files are parsed by default.\n\n---\ncorresponds to the `-F --extension value` option of _robot_\n", - "title": "Extensions", - "type": [ - "string", - "null" - ] + "title": "Extensions" }, "extra-args": { "default": null, @@ -2482,7 +3263,14 @@ "default": null, "description": "Appends entries to the --exclude option.\n\n---\n\nSelect test cases not to run by tag. These tests are\nnot run even if included with --include. Tags are\nmatched using same rules as with --include.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra excludes", "type": [ @@ -2491,18 +3279,15 @@ ] }, "extra-expand-keywords": { + "default": null, "description": "Appends entries to the --expandkeywords option.\n\n---\n\nMatching keywords will be automatically expanded in\nthe log file. Matching against keyword name or tags\nwork using same rules as with --removekeywords.\n\nExamples:\n\n```\n--expandkeywords name:BuiltIn.Log\n--expandkeywords tag:expand\n```\n\n---\ncorresponds to the `--expandkeywords name:|tag: *` option of _robot_\n", "items": { "anyOf": [ { - "type": "string" + "$ref": "#/definitions/NamePattern" }, { - "enum": [ - "name:", - "tag:" - ], - "type": "string" + "$ref": "#/definitions/TagPattern" } ] }, @@ -2523,11 +3308,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -2541,7 +3330,14 @@ "default": null, "description": "Appends entries to the --include option.\n\n---\n\nSelect tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra includes", "type": [ @@ -2553,7 +3349,14 @@ "default": null, "description": "Appends entries to the --language option.\n\n---\n\nActivate localization. `lang` can be a name or a code\nof a built-in language, or a path or a module name of\na custom language file.\n\n---\ncorresponds to the `--language lang *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra languages", "type": [ @@ -2564,7 +3367,14 @@ "extra-listeners": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -2578,7 +3388,14 @@ }, "extra-metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --metadata option.\n\n---\n\nSet metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -2610,7 +3427,14 @@ "extra-pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -2625,7 +3449,14 @@ "extra-pre-run-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -2641,7 +3472,14 @@ "default": null, "description": "Appends entries to the --pythonpath option.\n\n---\n\nAdditional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra python path", "type": [ @@ -2653,19 +3491,20 @@ "description": "Appends entries to the --removekeywords option.\n\n---\n\nRemove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -2679,7 +3518,14 @@ "default": null, "description": "Appends entries to the --settag option.\n\n---\n\nSets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra set tag", "type": [ @@ -2691,7 +3537,14 @@ "default": null, "description": "Appends entries to the --skip option.\n\n---\n\nTests having given tag will be skipped. Tag can be\na pattern.\n\n---\ncorresponds to the `--skip tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra skip", "type": [ @@ -2703,7 +3556,14 @@ "default": null, "description": "Appends entries to the --skiponfailure option.\n\n---\n\nTests having given tag will be skipped if they fail.\nTag can be a pattern\n\n---\ncorresponds to the `--skiponfailure tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra skip on failure", "type": [ @@ -2715,7 +3575,14 @@ "default": null, "description": "Appends entries to the --suite option.\n\n---\n\nSelect suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra suites", "type": [ @@ -2725,7 +3592,14 @@ }, "extra-tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagdoc option.\n\n---\n\nAdd documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -2736,14 +3610,24 @@ ] }, "extra-tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Appends entries to the --tagstatcombine option.\n\n---\n\nCreate combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Extra tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -2751,7 +3635,14 @@ "default": null, "description": "Appends entries to the --tagstatexclude option.\n\n---\n\nExclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat exclude", "type": [ @@ -2763,7 +3654,14 @@ "default": null, "description": "Appends entries to the --tagstatinclude option.\n\n---\n\nInclude only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tag stat include", "type": [ @@ -2773,7 +3671,14 @@ }, "extra-tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --tagstatlink option.\n\n---\n\nAdd external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -2787,7 +3692,14 @@ "default": null, "description": "Appends entries to the --task option.\n\n---\n\nAlias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tasks", "type": [ @@ -2799,7 +3711,14 @@ "default": null, "description": "Appends entries to the --test option.\n\n---\n\nSelect tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra tests", "type": [ @@ -2811,7 +3730,14 @@ "default": null, "description": "Appends entries to the --variablefile option.\n\n---\n\nPython or YAML file file to read variables from.\nPossible arguments to the variable file can be given\nafter the path using colon or semicolon as separator.\n\nExamples:\n\n```\n--variablefile path/vars.yaml\n--variablefile environment.py:testing\n```\n\n---\ncorresponds to the `-V --variablefile path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Extra variable files", "type": [ @@ -2821,7 +3747,14 @@ }, "extra-variables": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Appends entries to the --variable option.\n\n---\n\nSet variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`. See --variablefile for a more\npowerful variable setting mechanism.\n\nExamples:\n\n```\n--variable str:Hello => ${str} = `Hello`\n-v hi:Hi_World -E space:_ => ${hi} = `Hi World`\n-v x: -v y:42 => ${x} = ``, ${y} = `42`\n```\n\n---\ncorresponds to the `-v --variable name:value *` option of _robot_\n", @@ -2842,11 +3775,15 @@ "enum": [ "for", "while", - "iteration", - "name:", - "tag:" + "iteration" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -2860,7 +3797,14 @@ "default": null, "description": "Select tests by tag. Similarly as name with --test,\ntag is case and space insensitive and it is possible\nto use patterns with `*`, `?` and `[]` as wildcards.\nTags and patterns can also be combined together with\n`AND`, `OR`, and `NOT` operators.\n\nExamples:\n\n```\n--include foo --include bar*\n--include fooANDbar*\n```\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Includes", "type": [ @@ -2872,7 +3816,14 @@ "default": null, "description": "Activate localization. `lang` can be a name or a code\nof a built-in language, or a path or a module name of\na custom language file.\n\n---\ncorresponds to the `--language lang *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Languages", "type": [ @@ -2895,7 +3846,14 @@ "listeners": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -2908,31 +3866,52 @@ ] }, "log": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "HTML log file. Can be disabled by giving a special\nvalue `NONE`. Default: log.html\n\nExamples:\n\n```\n`--log mylog.html`, `-l NONE`\n```\n\n---\ncorresponds to the `-l --log file` option of _robot_\n", - "title": "Log", - "type": [ - "string", - "null" - ] + "title": "Log" }, "log-level": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Threshold level for logging. Available levels: TRACE,\nDEBUG, INFO (default), WARN, NONE (no logging). Use\nsyntax `LOGLEVEL:DEFAULT` to define the default\nvisible log level in log files.\n\nExamples:\n\n```\n--loglevel DEBUG\n--loglevel DEBUG:INFO\n```\n\n---\ncorresponds to the `-L --loglevel level` option of _robot_\n", - "title": "Log level", - "type": [ - "string", - "null" - ] + "title": "Log level" }, "log-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Title for the generated log file. The default title\nis ` Log`.\n\n---\ncorresponds to the `--logtitle title` option of _robot_\n", - "title": "Log title", - "type": [ - "string", - "null" - ] + "title": "Log title" }, "max-assign-length": { "default": null, @@ -2954,7 +3933,14 @@ }, "metadata": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Set metadata of the top level suite. Value can\ncontain formatting and be read from a file similarly\nas --doc. Example: --metadata Version:1.2\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", @@ -2965,13 +3951,20 @@ ] }, "name": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Set the name of the top level suite. By default the\nname is created based on the executed file or\ndirectory.\n\n---\ncorresponds to the `-N --name name` option of _robot_\n", - "title": "Name", - "type": [ - "string", - "null" - ] + "title": "Name" }, "no-status-rc": { "anyOf": [ @@ -2995,22 +3988,36 @@ "title": "No status rc" }, "output": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "XML output file. Given path, similarly as paths given\nto --log, --report, --xunit, and --debugfile, is\nrelative to --outputdir unless given as an absolute\npath. Other output files are created based on XML\noutput files after the test execution and XML outputs\ncan also be further processed with Rebot tool. Can be\ndisabled by giving a special value `NONE`.\nDefault: output.xml\n\n---\ncorresponds to the `-o --output file` option of _robot_\n", - "title": "Output", - "type": [ - "string", - "null" - ] + "title": "Output" }, "output-dir": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Where to create output files. The default is the\ndirectory where tests are run from and the given path\nis considered relative to that unless it is absolute.\n\n---\ncorresponds to the `-d --outputdir dir` option of _robot_\n", - "title": "Output dir", - "type": [ - "string", - "null" - ] + "title": "Output dir" }, "paths": { "anyOf": [ @@ -3034,7 +4041,14 @@ "pre-rebot-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -3049,7 +4063,14 @@ "pre-run-modifiers": { "additionalProperties": { "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "type": "array" }, @@ -3061,11 +4082,27 @@ "null" ] }, + "precedence": { + "default": null, + "description": "Precedence of the profile. Lower values are executed first. If not set the order is undefined.\n", + "title": "Precedence", + "type": [ + "integer", + "null" + ] + }, "python-path": { "default": null, "description": "Additional locations (directories, ZIPs) where to\nsearch libraries and other extensions when they are\nimported. Multiple paths can be given by separating\nthem with a colon (`:`) or by using this option\nseveral times. Given path can also be a glob pattern\nmatching multiple paths.\n\nExamples:\n\n```\n--pythonpath libs/\n--pythonpath /opt/libs:libraries.zip\n```\n\n---\ncorresponds to the `-P --pythonpath path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Python path", "type": [ @@ -3116,22 +4153,36 @@ "title": "Randomize" }, "re-run-failed": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Select failed tests from an earlier output file to be\nre-executed. Equivalent to selecting same tests\nindividually using --test.\n\n---\ncorresponds to the `-R --rerunfailed output` option of _robot_\n", - "title": "Re run failed", - "type": [ - "string", - "null" - ] + "title": "Re run failed" }, "re-run-failed-suites": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Select failed suites from an earlier output\nfile to be re-executed.\n\n---\ncorresponds to the `-S --rerunfailedsuites output` option of _robot_\n", - "title": "Re run failed suites", - "type": [ - "string", - "null" - ] + "title": "Re run failed suites" }, "rebot": { "anyOf": [ @@ -3149,19 +4200,20 @@ "description": "Remove keyword data from the generated log file.\nKeywords containing warnings are not removed except\nin the `all` mode.\nall: remove data from all keywords\npassed: remove data only from keywords in passed\ntest cases and suites\nfor: remove passed iterations from for loops\nwhile: remove passed iterations from while loops\nwuks: remove all but the last failing keyword\ninside `BuiltIn.Wait Until Keyword Succeeds`\nname:: remove data from keywords that match\nthe given pattern. The pattern is matched\nagainst the full name of the keyword (e.g.\n'MyLib.Keyword', 'resource.Second Keyword'),\nis case, space, and underscore insensitive,\nand may contain `*`, `?` and `[]` wildcards.\n\nExamples:\n\n```\n--removekeywords name:Lib.HugeKw\n--removekeywords name:myresource.*\n```\n\n\ntag:: remove data from keywords that match\nthe given pattern. Tags are case and space\ninsensitive and patterns can contain `*`,\n`?` and `[]` wildcards. Tags and patterns\ncan also be combined together with `AND`,\n`OR`, and `NOT` operators.\n\nExamples:\n\n```\n--removekeywords foo\n--removekeywords fooANDbar*\n```\n\n---\ncorresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_\n", "items": { "anyOf": [ - { - "type": "string" - }, { "enum": [ "all", "passed", "for", - "wuks", - "name:", - "tag:" + "wuks" ], "type": "string" + }, + { + "$ref": "#/definitions/NamePattern" + }, + { + "$ref": "#/definitions/TagPattern" } ] }, @@ -3172,31 +4224,52 @@ ] }, "report": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "HTML report file. Can be disabled with `NONE`\nsimilarly as --log. Default: report.html\n\n---\ncorresponds to the `-r --report file` option of _robot_\n", - "title": "Report", - "type": [ - "string", - "null" - ] + "title": "Report" }, "report-background": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Background colors to use in the report file.\nGiven in format `passed:failed:skipped` where the\n`:skipped` part can be omitted. Both color names and\ncodes work.\n\nExamples:\n\n```\n--reportbackground green:red:yellow\n--reportbackground #00E:#E00\n```\n\n---\ncorresponds to the `--reportbackground colors` option of _robot_\n", - "title": "Report background", - "type": [ - "string", - "null" - ] + "title": "Report background" }, "report-title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "Title for the generated report file. The default\ntitle is ` Report`.\n\n---\ncorresponds to the `--reporttitle title` option of _robot_\n", - "title": "Report title", - "type": [ - "string", - "null" - ] + "title": "Report title" }, "rpa": { "anyOf": [ @@ -3244,7 +4317,14 @@ "default": null, "description": "Sets given tag(s) to all executed tests.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Set tag", "type": [ @@ -3256,8 +4336,15 @@ "default": null, "description": "Tests having given tag will be skipped. Tag can be\na pattern.\n\n---\ncorresponds to the `--skip tag *` option of _robot_\n", "items": { - "type": "string" - }, + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, "title": "Skip", "type": [ "array", @@ -3268,7 +4355,14 @@ "default": null, "description": "Tests having given tag will be skipped if they fail.\nTag can be a pattern\n\n---\ncorresponds to the `--skiponfailure tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Skip on failure", "type": [ @@ -3331,7 +4425,14 @@ "default": null, "description": "Select suites by name. When this option is used with\n--test, --include or --exclude, only tests in\nmatching suites and also matching other filtering\ncriteria are selected. Name can be a simple pattern\nsimilarly as with --test and it can contain parent\nname separated with a dot. For example, `-s X.Y`\nselects suite `Y` only if its parent is `X`.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Suites", "type": [ @@ -3341,7 +4442,14 @@ }, "tag-doc": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add documentation to tags matching the given\npattern. Documentation is shown in `Test Details` and\nalso as a tooltip in `Statistics by Tag`. Pattern can\nuse `*`, `?` and `[]` as wildcards like --test.\nDocumentation can contain formatting like --doc.\n\nExamples:\n\n```\n--tagdoc mytag:Example\n--tagdoc \"owner-*:Original author\"\n```\n\n---\ncorresponds to the `--tagdoc pattern:doc *` option of _robot_\n", @@ -3352,14 +4460,24 @@ ] }, "tag-stat-combine": { - "additionalProperties": { - "type": "string" - }, "default": null, "description": "Create combined statistics based on tags.\nThese statistics are added into `Statistics by Tag`.\nIf the optional `name` is not given, name of the\ncombined tag is got from the specified tags. Tags are\nmatched using the same rules as with --include.\n\nExamples:\n\n```\n--tagstatcombine requirement-*\n--tagstatcombine tag1ANDtag2:My_name\n```\n\n---\ncorresponds to the `--tagstatcombine tags:name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + ] + }, "title": "Tag stat combine", "type": [ - "object", + "array", "null" ] }, @@ -3367,7 +4485,14 @@ "default": null, "description": "Exclude matching tags from `Statistics by Tag`.\nThis option can be used with --tagstatinclude\nsimilarly as --exclude is used with --include.\n\n---\ncorresponds to the `--tagstatexclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat exclude", "type": [ @@ -3379,7 +4504,14 @@ "default": null, "description": "Include only matching tags in `Statistics by Tag`\nin log and report. By default all tags are shown.\nGiven tag can be a pattern like with --include.\n\n---\ncorresponds to the `--tagstatinclude tag *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tag stat include", "type": [ @@ -3389,7 +4521,14 @@ }, "tag-stat-link": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Add external links into `Statistics by\nTag`. Pattern can use `*`, `?` and `[]` as wildcards\nlike --test. Characters matching to `*` and `?`\nwildcards can be used in link and title with syntax\n%N, where N is index of the match (starting from 1).\n\nExamples:\n\n```\n--tagstatlink mytag:http://my.domain:Title\n--tagstatlink \"bug-*:http://url/id=%1:Issue Tracker\"\n```\n\n---\ncorresponds to the `--tagstatlink pattern:link:title *` option of _robot_\n", @@ -3403,7 +4542,14 @@ "default": null, "description": "Alias to --test. Especially applicable with --rpa.\n\n---\ncorresponds to the `--task name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tasks", "type": [ @@ -3411,11 +4557,31 @@ "null" ] }, + "testdoc": { + "anyOf": [ + { + "$ref": "#/definitions/TestDocProfile" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Options to be passed to _testdoc_.\n", + "title": "Testdoc" + }, "tests": { "default": null, "description": "Select tests by name or by long name containing also\nparent suite name like `Parent.Test`. Name is case\nand space insensitive and it can also be a simple\npattern where `*` matches anything, `?` matches any\nsingle character, and `[chars]` matches one character\nin brackets.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Tests", "type": [ @@ -3448,7 +4614,14 @@ "default": null, "description": "Python or YAML file file to read variables from.\nPossible arguments to the variable file can be given\nafter the path using colon or semicolon as separator.\n\nExamples:\n\n```\n--variablefile path/vars.yaml\n--variablefile environment.py:testing\n```\n\n---\ncorresponds to the `-V --variablefile path *` option of _robot_\n", "items": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "title": "Variable files", "type": [ @@ -3458,7 +4631,14 @@ }, "variables": { "additionalProperties": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] }, "default": null, "description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`. See --variablefile for a more\npowerful variable setting mechanism.\n\nExamples:\n\n```\n--variable str:Hello => ${str} = `Hello`\n-v hi:Hi_World -E space:_ => ${hi} = `Hi World`\n-v x: -v y:42 => ${x} = ``, ${y} = `42`\n```\n\n---\ncorresponds to the `-v --variable name:value *` option of _robot_\n", @@ -3469,16 +4649,339 @@ ] }, "xunit": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], "default": null, "description": "xUnit compatible result file. Not created unless this\noption is specified.\n\n---\ncorresponds to the `-x --xunit file` option of _robot_\n", - "title": "Xunit", + "title": "Xunit" + } + }, + "title": "RobotProfile", + "type": "object" + }, + "StringExpression": { + "additionalProperties": false, + "description": "Expression to evaluate to a string.", + "properties": { + "expr": { + "description": "Condition to evaluate. This must be a Python \"eval\" expression.\nFor security reasons, only certain expressions and functions are allowed.\n\nExamples:\n```toml\nif = \"re.match(r'^\\d+$', environ.get('TEST_VAR', ''))\"\nif = \"platform.system() == 'Linux'\"\n```\n", + "title": "Expr", + "type": "string" + } + }, + "required": [ + "expr" + ], + "title": "StringExpression", + "type": "object" + }, + "TagPattern": { + "additionalProperties": false, + "description": "Tag pattern to match.", + "properties": { + "tag": { + "description": "Tag pattern to match. This is a glob pattern, where ``*`` matches any number of characters\n", + "title": "Tag", + "type": "string" + } + }, + "required": [ + "tag" + ], + "title": "TagPattern", + "type": "object" + }, + "TestDocProfile": { + "additionalProperties": false, + "description": "Profile for _testdoc_ command.", + "properties": { + "doc": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Override the documentation of the top level suite.\n\n---\ncorresponds to the `-D --doc document` option of _robot_\n", + "title": "Doc" + }, + "excludes": { + "default": null, + "description": "Exclude tests by tags.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Excludes", "type": [ - "string", + "array", + "null" + ] + }, + "extra-excludes": { + "default": null, + "description": "Appends entries to the --exclude option.\n\n---\n\nExclude tests by tags.\n\n---\ncorresponds to the `-e --exclude tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Extra excludes", + "type": [ + "array", "null" ] + }, + "extra-includes": { + "default": null, + "description": "Appends entries to the --include option.\n\n---\n\nInclude tests by tags.\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Extra includes", + "type": [ + "array", + "null" + ] + }, + "extra-metadata": { + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "default": null, + "description": "Appends entries to the --metadata option.\n\n---\n\nSet/override metadata of the top level suite.\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", + "title": "Extra metadata", + "type": [ + "object", + "null" + ] + }, + "extra-set-tag": { + "default": null, + "description": "Appends entries to the --settag option.\n\n---\n\nSet given tag(s) to all test cases.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Extra set tag", + "type": [ + "array", + "null" + ] + }, + "extra-suites": { + "default": null, + "description": "Appends entries to the --suite option.\n\n---\n\nInclude suites by name.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Extra suites", + "type": [ + "array", + "null" + ] + }, + "extra-tests": { + "default": null, + "description": "Appends entries to the --test option.\n\n---\n\nInclude tests by name.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Extra tests", + "type": [ + "array", + "null" + ] + }, + "includes": { + "default": null, + "description": "Include tests by tags.\n\n---\ncorresponds to the `-i --include tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Includes", + "type": [ + "array", + "null" + ] + }, + "metadata": { + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "default": null, + "description": "Set/override metadata of the top level suite.\n\n---\ncorresponds to the `-M --metadata name:value *` option of _robot_\n", + "title": "Metadata", + "type": [ + "object", + "null" + ] + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Override the name of the top level suite.\n\n---\ncorresponds to the `-N --name name` option of _robot_\n", + "title": "Name" + }, + "set-tag": { + "default": null, + "description": "Set given tag(s) to all test cases.\n\n---\ncorresponds to the `-G --settag tag *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Set tag", + "type": [ + "array", + "null" + ] + }, + "suites": { + "default": null, + "description": "Include suites by name.\n\n---\ncorresponds to the `-s --suite name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Suites", + "type": [ + "array", + "null" + ] + }, + "tests": { + "default": null, + "description": "Include tests by name.\n\n---\ncorresponds to the `-t --test name *` option of _robot_\n", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + } + ] + }, + "title": "Tests", + "type": [ + "array", + "null" + ] + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/StringExpression" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Set the title of the generated documentation.\nUnderscores in the title are converted to spaces.\nThe default title is the name of the top level suite.\n\n---\ncorresponds to the `-T --title title` option of _robot_\n", + "title": "Title" } }, - "title": "RobotProfile", + "title": "TestDocProfile", "type": "object" } }, diff --git a/hatch.toml b/hatch.toml index be1687a0c..54b5c3b86 100644 --- a/hatch.toml +++ b/hatch.toml @@ -1,11 +1,16 @@ [version] -path = "robotcode/cli/__version__.py" +path = "src/robotcode/cli/__version__.py" -[build.targets.sdist] -only-include = ["robotcode", "CHANGELOG.md"] +[build] +dev-mode-dirs = ["src"] [build.targets.wheel] -only-include = ["robotcode"] +only-include = ["src/robotcode"] +sources = ["src"] + +[build.targets.sdist] +only-include = ["src", "CHANGELOG.md"] + [envs.default] dependencies = [ @@ -114,6 +119,7 @@ deploy = ["python scripts/deploy_docs.py"] [envs.build] +skip-install = true detached = true python = "38" dependencies = ["GitPython", "semantic-version"] diff --git a/package.json b/package.json index 0f7b00a6a..fc9719394 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "RobotFramework support for Visual Studio Code", "icon": "images/icon.png", "publisher": "d-biehl", - "version": "0.31.0", + "version": "0.32.0", "author": { "name": "Daniel Biehl", "url": "https://github.com/d-biehl/" diff --git a/packages/analyze/pyproject.toml b/packages/analyze/pyproject.toml index 86edbfd8e..a159612c0 100644 --- a/packages/analyze/pyproject.toml +++ b/packages/analyze/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-analyze" description = 'RobotCode analyze plugin for Robot Framework' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -25,11 +25,7 @@ classifiers = [ "Framework :: Robot Framework", "Framework :: Robot Framework :: Tool", ] -dependencies = [ - "robotframework>=4.1.0", - "robotcode-plugin", - "robotcode-robot" -] +dependencies = ["robotframework>=4.1.0", "robotcode-plugin", "robotcode-robot"] dynamic = ["version"] [project.entry-points.robotcode] @@ -44,15 +40,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/analyze/__version__.py" +path = "src/robotcode/analyze/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/analyze/robotcode/analyze/__version__.py b/packages/analyze/robotcode/analyze/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/analyze/robotcode/analyze/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/analyze/robotcode/analyze/__init__.py b/packages/analyze/src/robotcode/analyze/__init__.py similarity index 100% rename from packages/analyze/robotcode/analyze/__init__.py rename to packages/analyze/src/robotcode/analyze/__init__.py diff --git a/packages/analyze/robotcode/analyze/__main__.py b/packages/analyze/src/robotcode/analyze/__main__.py similarity index 100% rename from packages/analyze/robotcode/analyze/__main__.py rename to packages/analyze/src/robotcode/analyze/__main__.py diff --git a/packages/analyze/src/robotcode/analyze/__version__.py b/packages/analyze/src/robotcode/analyze/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/analyze/src/robotcode/analyze/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/analyze/robotcode/analyze/cli/__init__.py b/packages/analyze/src/robotcode/analyze/cli/__init__.py similarity index 100% rename from packages/analyze/robotcode/analyze/cli/__init__.py rename to packages/analyze/src/robotcode/analyze/cli/__init__.py diff --git a/packages/analyze/robotcode/analyze/hooks.py b/packages/analyze/src/robotcode/analyze/hooks.py similarity index 99% rename from packages/analyze/robotcode/analyze/hooks.py rename to packages/analyze/src/robotcode/analyze/hooks.py index 69a549aa2..2da5290dd 100644 --- a/packages/analyze/robotcode/analyze/hooks.py +++ b/packages/analyze/src/robotcode/analyze/hooks.py @@ -1,7 +1,6 @@ from typing import List import click - from robotcode.plugin import hookimpl from .cli import analyze diff --git a/packages/analyze/robotcode/analyze/py.typed b/packages/analyze/src/robotcode/analyze/py.typed similarity index 100% rename from packages/analyze/robotcode/analyze/py.typed rename to packages/analyze/src/robotcode/analyze/py.typed diff --git a/packages/core/pyproject.toml b/packages/core/pyproject.toml index f427dd25d..7aea8a6fe 100644 --- a/packages/core/pyproject.toml +++ b/packages/core/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-core" description = 'Some core classes for RobotCode' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -37,15 +37,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/core/__version__.py" +path = "src/robotcode/core/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/core/robotcode/core/__version__.py b/packages/core/robotcode/core/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/core/robotcode/core/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/core/robotcode/core/__init__.py b/packages/core/src/robotcode/core/__init__.py similarity index 100% rename from packages/core/robotcode/core/__init__.py rename to packages/core/src/robotcode/core/__init__.py diff --git a/packages/core/src/robotcode/core/__version__.py b/packages/core/src/robotcode/core/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/core/src/robotcode/core/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/core/robotcode/core/async_cache.py b/packages/core/src/robotcode/core/async_cache.py similarity index 100% rename from packages/core/robotcode/core/async_cache.py rename to packages/core/src/robotcode/core/async_cache.py diff --git a/packages/core/robotcode/core/async_itertools.py b/packages/core/src/robotcode/core/async_itertools.py similarity index 100% rename from packages/core/robotcode/core/async_itertools.py rename to packages/core/src/robotcode/core/async_itertools.py diff --git a/packages/core/robotcode/core/async_tools.py b/packages/core/src/robotcode/core/async_tools.py similarity index 100% rename from packages/core/robotcode/core/async_tools.py rename to packages/core/src/robotcode/core/async_tools.py diff --git a/packages/core/robotcode/core/dataclasses.py b/packages/core/src/robotcode/core/dataclasses.py similarity index 96% rename from packages/core/robotcode/core/dataclasses.py rename to packages/core/src/robotcode/core/dataclasses.py index 66a471c05..41c806c55 100644 --- a/packages/core/robotcode/core/dataclasses.py +++ b/packages/core/src/robotcode/core/dataclasses.py @@ -324,11 +324,20 @@ def from_dict( return cast(_T, v) raise TypeError( - f"Cant convert value {repr(value)} of type {type(value).__name__} to type " + repr(types[0]) - if len(types) == 1 - else " | ".join( - ((getattr(e, "__name__", None) or str(e) if e is not type(None) else "None") if e is not None else "None") - for e in types + f"Cant convert value {repr(value)} of type {type(value).__name__} to type(s) " + + ( + repr(types[0]) + if len(types) == 1 + else " | ".join( + ( + (getattr(e, "__name__", None) or str(e) if e is not type(None) else "None") + if get_origin(e) is not Literal + else repr(e).replace("typing.", "") + if e is not None + else "None" + ) + for e in types + ) ) + "." ) diff --git a/packages/core/robotcode/core/event.py b/packages/core/src/robotcode/core/event.py similarity index 100% rename from packages/core/robotcode/core/event.py rename to packages/core/src/robotcode/core/event.py diff --git a/packages/core/robotcode/core/logging.py b/packages/core/src/robotcode/core/logging.py similarity index 100% rename from packages/core/robotcode/core/logging.py rename to packages/core/src/robotcode/core/logging.py diff --git a/packages/core/robotcode/core/py.typed b/packages/core/src/robotcode/core/py.typed similarity index 100% rename from packages/core/robotcode/core/py.typed rename to packages/core/src/robotcode/core/py.typed diff --git a/packages/core/robotcode/core/uri.py b/packages/core/src/robotcode/core/uri.py similarity index 100% rename from packages/core/robotcode/core/uri.py rename to packages/core/src/robotcode/core/uri.py diff --git a/packages/core/robotcode/core/utils/debugpy.py b/packages/core/src/robotcode/core/utils/debugpy.py similarity index 100% rename from packages/core/robotcode/core/utils/debugpy.py rename to packages/core/src/robotcode/core/utils/debugpy.py diff --git a/packages/core/robotcode/core/utils/glob_path.py b/packages/core/src/robotcode/core/utils/glob_path.py similarity index 100% rename from packages/core/robotcode/core/utils/glob_path.py rename to packages/core/src/robotcode/core/utils/glob_path.py diff --git a/packages/core/robotcode/core/utils/inspect.py b/packages/core/src/robotcode/core/utils/inspect.py similarity index 100% rename from packages/core/robotcode/core/utils/inspect.py rename to packages/core/src/robotcode/core/utils/inspect.py diff --git a/packages/core/robotcode/core/utils/net.py b/packages/core/src/robotcode/core/utils/net.py similarity index 100% rename from packages/core/robotcode/core/utils/net.py rename to packages/core/src/robotcode/core/utils/net.py diff --git a/packages/core/robotcode/core/utils/path.py b/packages/core/src/robotcode/core/utils/path.py similarity index 100% rename from packages/core/robotcode/core/utils/path.py rename to packages/core/src/robotcode/core/utils/path.py diff --git a/packages/core/robotcode/core/utils/safe_eval.py b/packages/core/src/robotcode/core/utils/safe_eval.py similarity index 100% rename from packages/core/robotcode/core/utils/safe_eval.py rename to packages/core/src/robotcode/core/utils/safe_eval.py diff --git a/packages/core/robotcode/core/utils/version.py b/packages/core/src/robotcode/core/utils/version.py similarity index 100% rename from packages/core/robotcode/core/utils/version.py rename to packages/core/src/robotcode/core/utils/version.py diff --git a/packages/debugger/pyproject.toml b/packages/debugger/pyproject.toml index 2726dc492..ebbce38be 100644 --- a/packages/debugger/pyproject.toml +++ b/packages/debugger/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-debugger" description = 'RobotCode Debugger for Robot Framework' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -43,14 +43,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/debugger/__version__.py" +path = "src/robotcode/debugger/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/debugger/robotcode/debugger/__version__.py b/packages/debugger/robotcode/debugger/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/debugger/robotcode/debugger/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/debugger/robotcode/debugger/__init__.py b/packages/debugger/src/robotcode/debugger/__init__.py similarity index 100% rename from packages/debugger/robotcode/debugger/__init__.py rename to packages/debugger/src/robotcode/debugger/__init__.py diff --git a/packages/debugger/robotcode/debugger/__main__.py b/packages/debugger/src/robotcode/debugger/__main__.py similarity index 100% rename from packages/debugger/robotcode/debugger/__main__.py rename to packages/debugger/src/robotcode/debugger/__main__.py diff --git a/packages/debugger/src/robotcode/debugger/__version__.py b/packages/debugger/src/robotcode/debugger/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/debugger/src/robotcode/debugger/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/debugger/robotcode/debugger/cli.py b/packages/debugger/src/robotcode/debugger/cli.py similarity index 99% rename from packages/debugger/robotcode/debugger/cli.py rename to packages/debugger/src/robotcode/debugger/cli.py index d9d506bc7..9d59a642f 100644 --- a/packages/debugger/robotcode/debugger/cli.py +++ b/packages/debugger/src/robotcode/debugger/cli.py @@ -127,7 +127,6 @@ async def run_robot( stop_on_entry: bool = False, ) -> int: import robot - from robotcode.core.async_tools import ( run_coroutine_from_thread_async, run_coroutine_in_thread, diff --git a/packages/debugger/robotcode/debugger/client.py b/packages/debugger/src/robotcode/debugger/client.py similarity index 100% rename from packages/debugger/robotcode/debugger/client.py rename to packages/debugger/src/robotcode/debugger/client.py diff --git a/packages/debugger/robotcode/debugger/dap_types.py b/packages/debugger/src/robotcode/debugger/dap_types.py similarity index 100% rename from packages/debugger/robotcode/debugger/dap_types.py rename to packages/debugger/src/robotcode/debugger/dap_types.py diff --git a/packages/debugger/robotcode/debugger/debugger.py b/packages/debugger/src/robotcode/debugger/debugger.py similarity index 100% rename from packages/debugger/robotcode/debugger/debugger.py rename to packages/debugger/src/robotcode/debugger/debugger.py diff --git a/packages/debugger/robotcode/debugger/launcher/__init__.py b/packages/debugger/src/robotcode/debugger/launcher/__init__.py similarity index 100% rename from packages/debugger/robotcode/debugger/launcher/__init__.py rename to packages/debugger/src/robotcode/debugger/launcher/__init__.py diff --git a/packages/debugger/robotcode/debugger/launcher/__main__.py b/packages/debugger/src/robotcode/debugger/launcher/__main__.py similarity index 100% rename from packages/debugger/robotcode/debugger/launcher/__main__.py rename to packages/debugger/src/robotcode/debugger/launcher/__main__.py diff --git a/packages/debugger/robotcode/debugger/launcher/cli.py b/packages/debugger/src/robotcode/debugger/launcher/cli.py similarity index 100% rename from packages/debugger/robotcode/debugger/launcher/cli.py rename to packages/debugger/src/robotcode/debugger/launcher/cli.py diff --git a/packages/debugger/robotcode/debugger/launcher/server.py b/packages/debugger/src/robotcode/debugger/launcher/server.py similarity index 100% rename from packages/debugger/robotcode/debugger/launcher/server.py rename to packages/debugger/src/robotcode/debugger/launcher/server.py diff --git a/packages/debugger/robotcode/debugger/listeners.py b/packages/debugger/src/robotcode/debugger/listeners.py similarity index 100% rename from packages/debugger/robotcode/debugger/listeners.py rename to packages/debugger/src/robotcode/debugger/listeners.py diff --git a/packages/debugger/robotcode/debugger/protocol.py b/packages/debugger/src/robotcode/debugger/protocol.py similarity index 100% rename from packages/debugger/robotcode/debugger/protocol.py rename to packages/debugger/src/robotcode/debugger/protocol.py diff --git a/packages/debugger/robotcode/debugger/py.typed b/packages/debugger/src/robotcode/debugger/py.typed similarity index 100% rename from packages/debugger/robotcode/debugger/py.typed rename to packages/debugger/src/robotcode/debugger/py.typed diff --git a/packages/debugger/robotcode/debugger/server.py b/packages/debugger/src/robotcode/debugger/server.py similarity index 100% rename from packages/debugger/robotcode/debugger/server.py rename to packages/debugger/src/robotcode/debugger/server.py diff --git a/packages/jsonrpc2/pyproject.toml b/packages/jsonrpc2/pyproject.toml index 84033cd73..b6e13c690 100644 --- a/packages/jsonrpc2/pyproject.toml +++ b/packages/jsonrpc2/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-jsonrpc2" description = 'JSONRPC Server for RobotCode' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -37,14 +37,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/jsonrpc2/__version__.py" +path = "src/robotcode/jsonrpc2/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/jsonrpc2/robotcode/jsonrpc2/__version__.py b/packages/jsonrpc2/robotcode/jsonrpc2/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/jsonrpc2/robotcode/jsonrpc2/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/jsonrpc2/robotcode/jsonrpc2/__init__.py b/packages/jsonrpc2/src/robotcode/jsonrpc2/__init__.py similarity index 100% rename from packages/jsonrpc2/robotcode/jsonrpc2/__init__.py rename to packages/jsonrpc2/src/robotcode/jsonrpc2/__init__.py diff --git a/packages/jsonrpc2/src/robotcode/jsonrpc2/__version__.py b/packages/jsonrpc2/src/robotcode/jsonrpc2/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/jsonrpc2/src/robotcode/jsonrpc2/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/jsonrpc2/robotcode/jsonrpc2/protocol.py b/packages/jsonrpc2/src/robotcode/jsonrpc2/protocol.py similarity index 100% rename from packages/jsonrpc2/robotcode/jsonrpc2/protocol.py rename to packages/jsonrpc2/src/robotcode/jsonrpc2/protocol.py diff --git a/packages/jsonrpc2/robotcode/jsonrpc2/py.typed b/packages/jsonrpc2/src/robotcode/jsonrpc2/py.typed similarity index 100% rename from packages/jsonrpc2/robotcode/jsonrpc2/py.typed rename to packages/jsonrpc2/src/robotcode/jsonrpc2/py.typed diff --git a/packages/jsonrpc2/robotcode/jsonrpc2/server.py b/packages/jsonrpc2/src/robotcode/jsonrpc2/server.py similarity index 100% rename from packages/jsonrpc2/robotcode/jsonrpc2/server.py rename to packages/jsonrpc2/src/robotcode/jsonrpc2/server.py diff --git a/packages/language_server/pyproject.toml b/packages/language_server/pyproject.toml index 7d34e6b0f..0264cfc87 100644 --- a/packages/language_server/pyproject.toml +++ b/packages/language_server/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-language-server" description = 'RobotCode Language Server for Robot Framework' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -40,14 +40,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/language_server/__version__.py" +path = "src/robotcode/language_server/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/language_server/robotcode/language_server/__version__.py b/packages/language_server/robotcode/language_server/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/language_server/robotcode/language_server/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/language_server/robotcode/language_server/__init__.py b/packages/language_server/src/robotcode/language_server/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/__init__.py rename to packages/language_server/src/robotcode/language_server/__init__.py diff --git a/packages/language_server/robotcode/language_server/__main__.py b/packages/language_server/src/robotcode/language_server/__main__.py similarity index 100% rename from packages/language_server/robotcode/language_server/__main__.py rename to packages/language_server/src/robotcode/language_server/__main__.py diff --git a/packages/language_server/src/robotcode/language_server/__version__.py b/packages/language_server/src/robotcode/language_server/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/language_server/src/robotcode/language_server/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/language_server/robotcode/language_server/cli.py b/packages/language_server/src/robotcode/language_server/cli.py similarity index 100% rename from packages/language_server/robotcode/language_server/cli.py rename to packages/language_server/src/robotcode/language_server/cli.py diff --git a/packages/language_server/robotcode/language_server/common/__init__.py b/packages/language_server/src/robotcode/language_server/common/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/__init__.py rename to packages/language_server/src/robotcode/language_server/common/__init__.py diff --git a/packages/language_server/robotcode/language_server/common/decorators.py b/packages/language_server/src/robotcode/language_server/common/decorators.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/decorators.py rename to packages/language_server/src/robotcode/language_server/common/decorators.py diff --git a/packages/language_server/robotcode/language_server/common/has_extend_capabilities.py b/packages/language_server/src/robotcode/language_server/common/has_extend_capabilities.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/has_extend_capabilities.py rename to packages/language_server/src/robotcode/language_server/common/has_extend_capabilities.py diff --git a/packages/language_server/robotcode/language_server/common/lsp_types.py b/packages/language_server/src/robotcode/language_server/common/lsp_types.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/lsp_types.py rename to packages/language_server/src/robotcode/language_server/common/lsp_types.py diff --git a/packages/language_server/robotcode/language_server/common/parts/__init__.py b/packages/language_server/src/robotcode/language_server/common/parts/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/__init__.py rename to packages/language_server/src/robotcode/language_server/common/parts/__init__.py diff --git a/packages/language_server/robotcode/language_server/common/parts/code_action.py b/packages/language_server/src/robotcode/language_server/common/parts/code_action.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/code_action.py rename to packages/language_server/src/robotcode/language_server/common/parts/code_action.py diff --git a/packages/language_server/robotcode/language_server/common/parts/code_lens.py b/packages/language_server/src/robotcode/language_server/common/parts/code_lens.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/code_lens.py rename to packages/language_server/src/robotcode/language_server/common/parts/code_lens.py diff --git a/packages/language_server/robotcode/language_server/common/parts/commands.py b/packages/language_server/src/robotcode/language_server/common/parts/commands.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/commands.py rename to packages/language_server/src/robotcode/language_server/common/parts/commands.py diff --git a/packages/language_server/robotcode/language_server/common/parts/completion.py b/packages/language_server/src/robotcode/language_server/common/parts/completion.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/completion.py rename to packages/language_server/src/robotcode/language_server/common/parts/completion.py diff --git a/packages/language_server/robotcode/language_server/common/parts/declaration.py b/packages/language_server/src/robotcode/language_server/common/parts/declaration.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/declaration.py rename to packages/language_server/src/robotcode/language_server/common/parts/declaration.py diff --git a/packages/language_server/robotcode/language_server/common/parts/definition.py b/packages/language_server/src/robotcode/language_server/common/parts/definition.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/definition.py rename to packages/language_server/src/robotcode/language_server/common/parts/definition.py diff --git a/packages/language_server/robotcode/language_server/common/parts/diagnostics.py b/packages/language_server/src/robotcode/language_server/common/parts/diagnostics.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/diagnostics.py rename to packages/language_server/src/robotcode/language_server/common/parts/diagnostics.py diff --git a/packages/language_server/robotcode/language_server/common/parts/document_highlight.py b/packages/language_server/src/robotcode/language_server/common/parts/document_highlight.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/document_highlight.py rename to packages/language_server/src/robotcode/language_server/common/parts/document_highlight.py diff --git a/packages/language_server/robotcode/language_server/common/parts/document_symbols.py b/packages/language_server/src/robotcode/language_server/common/parts/document_symbols.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/document_symbols.py rename to packages/language_server/src/robotcode/language_server/common/parts/document_symbols.py diff --git a/packages/language_server/robotcode/language_server/common/parts/documents.py b/packages/language_server/src/robotcode/language_server/common/parts/documents.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/documents.py rename to packages/language_server/src/robotcode/language_server/common/parts/documents.py diff --git a/packages/language_server/robotcode/language_server/common/parts/folding_range.py b/packages/language_server/src/robotcode/language_server/common/parts/folding_range.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/folding_range.py rename to packages/language_server/src/robotcode/language_server/common/parts/folding_range.py diff --git a/packages/language_server/robotcode/language_server/common/parts/formatting.py b/packages/language_server/src/robotcode/language_server/common/parts/formatting.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/formatting.py rename to packages/language_server/src/robotcode/language_server/common/parts/formatting.py diff --git a/packages/language_server/robotcode/language_server/common/parts/hover.py b/packages/language_server/src/robotcode/language_server/common/parts/hover.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/hover.py rename to packages/language_server/src/robotcode/language_server/common/parts/hover.py diff --git a/packages/language_server/robotcode/language_server/common/parts/implementation.py b/packages/language_server/src/robotcode/language_server/common/parts/implementation.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/implementation.py rename to packages/language_server/src/robotcode/language_server/common/parts/implementation.py diff --git a/packages/language_server/robotcode/language_server/common/parts/inlay_hint.py b/packages/language_server/src/robotcode/language_server/common/parts/inlay_hint.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/inlay_hint.py rename to packages/language_server/src/robotcode/language_server/common/parts/inlay_hint.py diff --git a/packages/language_server/robotcode/language_server/common/parts/inline_value.py b/packages/language_server/src/robotcode/language_server/common/parts/inline_value.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/inline_value.py rename to packages/language_server/src/robotcode/language_server/common/parts/inline_value.py diff --git a/packages/language_server/robotcode/language_server/common/parts/linked_editing_ranges.py b/packages/language_server/src/robotcode/language_server/common/parts/linked_editing_ranges.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/linked_editing_ranges.py rename to packages/language_server/src/robotcode/language_server/common/parts/linked_editing_ranges.py diff --git a/packages/language_server/robotcode/language_server/common/parts/protocol_part.py b/packages/language_server/src/robotcode/language_server/common/parts/protocol_part.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/protocol_part.py rename to packages/language_server/src/robotcode/language_server/common/parts/protocol_part.py diff --git a/packages/language_server/robotcode/language_server/common/parts/references.py b/packages/language_server/src/robotcode/language_server/common/parts/references.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/references.py rename to packages/language_server/src/robotcode/language_server/common/parts/references.py diff --git a/packages/language_server/robotcode/language_server/common/parts/rename.py b/packages/language_server/src/robotcode/language_server/common/parts/rename.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/rename.py rename to packages/language_server/src/robotcode/language_server/common/parts/rename.py diff --git a/packages/language_server/robotcode/language_server/common/parts/selection_range.py b/packages/language_server/src/robotcode/language_server/common/parts/selection_range.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/selection_range.py rename to packages/language_server/src/robotcode/language_server/common/parts/selection_range.py diff --git a/packages/language_server/robotcode/language_server/common/parts/semantic_tokens.py b/packages/language_server/src/robotcode/language_server/common/parts/semantic_tokens.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/semantic_tokens.py rename to packages/language_server/src/robotcode/language_server/common/parts/semantic_tokens.py diff --git a/packages/language_server/robotcode/language_server/common/parts/signature_help.py b/packages/language_server/src/robotcode/language_server/common/parts/signature_help.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/signature_help.py rename to packages/language_server/src/robotcode/language_server/common/parts/signature_help.py diff --git a/packages/language_server/robotcode/language_server/common/parts/window.py b/packages/language_server/src/robotcode/language_server/common/parts/window.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/window.py rename to packages/language_server/src/robotcode/language_server/common/parts/window.py diff --git a/packages/language_server/robotcode/language_server/common/parts/workspace.py b/packages/language_server/src/robotcode/language_server/common/parts/workspace.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/parts/workspace.py rename to packages/language_server/src/robotcode/language_server/common/parts/workspace.py diff --git a/packages/language_server/robotcode/language_server/common/protocol.py b/packages/language_server/src/robotcode/language_server/common/protocol.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/protocol.py rename to packages/language_server/src/robotcode/language_server/common/protocol.py diff --git a/packages/language_server/robotcode/language_server/common/server.py b/packages/language_server/src/robotcode/language_server/common/server.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/server.py rename to packages/language_server/src/robotcode/language_server/common/server.py diff --git a/packages/language_server/robotcode/language_server/common/text_document.py b/packages/language_server/src/robotcode/language_server/common/text_document.py similarity index 100% rename from packages/language_server/robotcode/language_server/common/text_document.py rename to packages/language_server/src/robotcode/language_server/common/text_document.py diff --git a/packages/language_server/robotcode/language_server/py.typed b/packages/language_server/src/robotcode/language_server/py.typed similarity index 100% rename from packages/language_server/robotcode/language_server/py.typed rename to packages/language_server/src/robotcode/language_server/py.typed diff --git a/packages/language_server/robotcode/language_server/robotframework/__init__.py b/packages/language_server/src/robotcode/language_server/robotframework/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/__init__.py rename to packages/language_server/src/robotcode/language_server/robotframework/__init__.py diff --git a/packages/language_server/robotcode/language_server/robotframework/configuration.py b/packages/language_server/src/robotcode/language_server/robotframework/configuration.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/configuration.py rename to packages/language_server/src/robotcode/language_server/robotframework/configuration.py diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/__init__.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/__init__.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/__init__.py diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/analyzer.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/analyzer.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/analyzer.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/analyzer.py diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/entities.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/entities.py similarity index 99% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/entities.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/entities.py index 222df5942..6c777de73 100644 --- a/packages/language_server/robotcode/language_server/robotframework/diagnostics/entities.py +++ b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/entities.py @@ -117,7 +117,6 @@ class InvalidVariableError(Exception): class VariableMatcher: def __init__(self, name: str) -> None: from robot.variables.search import search_variable - from robotcode.language_server.robotframework.utils.match import normalize self.name = name diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/imports_manager.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/imports_manager.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/imports_manager.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/imports_manager.py diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/library_doc.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/library_doc.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/library_doc.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/library_doc.py diff --git a/packages/language_server/robotcode/language_server/robotframework/diagnostics/namespace.py b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/namespace.py similarity index 99% rename from packages/language_server/robotcode/language_server/robotframework/diagnostics/namespace.py rename to packages/language_server/src/robotcode/language_server/robotframework/diagnostics/namespace.py index a14c569e1..03bfadf2f 100644 --- a/packages/language_server/robotcode/language_server/robotframework/diagnostics/namespace.py +++ b/packages/language_server/src/robotcode/language_server/robotframework/diagnostics/namespace.py @@ -191,7 +191,6 @@ def visit_KeywordName(self, node: ast.AST) -> None: # noqa: N802 from robot.parsing.lexer.tokens import Token as RobotToken from robot.parsing.model.statements import KeywordName from robot.variables.search import search_variable - from robotcode.language_server.robotframework.parts.model_helper import ModelHelperMixin n = cast(KeywordName, node) diff --git a/packages/language_server/robotcode/language_server/robotframework/languages.py b/packages/language_server/src/robotcode/language_server/robotframework/languages.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/languages.py rename to packages/language_server/src/robotcode/language_server/robotframework/languages.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/__init__.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/__init__.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/__init__.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/code_action_documentation.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/code_action_documentation.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/code_action_documentation.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/code_action_documentation.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/code_action_fixes.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/code_action_fixes.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/code_action_fixes.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/code_action_fixes.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/codelens.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/codelens.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/codelens.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/codelens.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/completion.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/completion.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/debugging_utils.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/debugging_utils.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/debugging_utils.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/debugging_utils.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/diagnostics.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/diagnostics.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/diagnostics.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/diagnostics.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/discovering.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/discovering.py similarity index 99% rename from packages/language_server/robotcode/language_server/robotframework/parts/discovering.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/discovering.py index 07f34ecc8..e856fe09b 100644 --- a/packages/language_server/robotcode/language_server/robotframework/parts/discovering.py +++ b/packages/language_server/src/robotcode/language_server/robotframework/parts/discovering.py @@ -113,7 +113,6 @@ def _patch(self) -> None: from robot.api.parsing import File, get_model from robot.running import TestSuite from robot.running.builder.builders import RobotParser, TestSuiteBuilder - from robotcode.language_server.robotframework.utils.version import ( get_robot_version, ) @@ -204,7 +203,6 @@ async def get_tests_from_workspace( from robot.output.logger import LOGGER from robot.running import TestCase, TestSuite from robot.running.builder.builders import TestSuiteBuilder - from robotcode.language_server.robotframework.utils.version import ( get_robot_version, ) diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/document_highlight.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/document_highlight.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/document_highlight.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/document_highlight.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/document_symbols.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/document_symbols.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/document_symbols.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/document_symbols.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/documents_cache.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/documents_cache.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/documents_cache.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/documents_cache.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/folding_range.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/folding_range.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/folding_range.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/folding_range.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/formatting.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/formatting.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/formatting.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/formatting.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/goto.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/goto.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/goto.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/goto.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/hover.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/hover.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/hover.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/hover.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/inlay_hint.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/inlay_hint.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/inlay_hint.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/inlay_hint.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/inline_value.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/inline_value.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/inline_value.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/inline_value.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/model_helper.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/model_helper.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/model_helper.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/model_helper.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/protocol_part.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/protocol_part.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/protocol_part.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/protocol_part.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/references.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/references.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/references.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/references.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/rename.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/rename.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/rename.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/rename.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/robocop_diagnostics.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/robocop_diagnostics.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/robocop_diagnostics.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/robocop_diagnostics.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/robot_workspace.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/robot_workspace.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/robot_workspace.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/robot_workspace.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/selection_range.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/selection_range.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/selection_range.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/selection_range.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/semantic_tokens.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/semantic_tokens.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/semantic_tokens.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/semantic_tokens.py diff --git a/packages/language_server/robotcode/language_server/robotframework/parts/signature_help.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/signature_help.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/parts/signature_help.py rename to packages/language_server/src/robotcode/language_server/robotframework/parts/signature_help.py diff --git a/packages/language_server/robotcode/language_server/robotframework/protocol.py b/packages/language_server/src/robotcode/language_server/robotframework/protocol.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/protocol.py rename to packages/language_server/src/robotcode/language_server/robotframework/protocol.py diff --git a/packages/language_server/robotcode/language_server/robotframework/server.py b/packages/language_server/src/robotcode/language_server/robotframework/server.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/server.py rename to packages/language_server/src/robotcode/language_server/robotframework/server.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/__init__.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/__init__.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/__init__.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/__init__.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/_variables.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/_variables.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/_variables.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/_variables.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/ast_utils.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/ast_utils.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/ast_utils.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/ast_utils.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/async_ast.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/async_ast.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/async_ast.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/async_ast.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/markdownformatter.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/markdownformatter.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/markdownformatter.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/markdownformatter.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/match.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/match.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/match.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/match.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/robot_path.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/robot_path.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/robot_path.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/robot_path.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/variables.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/variables.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/variables.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/variables.py diff --git a/packages/language_server/robotcode/language_server/robotframework/utils/version.py b/packages/language_server/src/robotcode/language_server/robotframework/utils/version.py similarity index 100% rename from packages/language_server/robotcode/language_server/robotframework/utils/version.py rename to packages/language_server/src/robotcode/language_server/robotframework/utils/version.py diff --git a/packages/modifiers/pyproject.toml b/packages/modifiers/pyproject.toml index db5ebd14d..1ba763638 100644 --- a/packages/modifiers/pyproject.toml +++ b/packages/modifiers/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-modifiers" description = 'Some Robot Framework Modifiers for RobotCode' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -37,14 +37,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/modifiers/__version__.py" +path = "src/robotcode/modifiers/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/modifiers/robotcode/modifiers/__version__.py b/packages/modifiers/robotcode/modifiers/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/modifiers/robotcode/modifiers/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/modifiers/robotcode/modifiers/__init__.py b/packages/modifiers/src/robotcode/modifiers/__init__.py similarity index 100% rename from packages/modifiers/robotcode/modifiers/__init__.py rename to packages/modifiers/src/robotcode/modifiers/__init__.py diff --git a/packages/modifiers/src/robotcode/modifiers/__version__.py b/packages/modifiers/src/robotcode/modifiers/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/modifiers/src/robotcode/modifiers/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/modifiers/robotcode/modifiers/longname_modifiers.py b/packages/modifiers/src/robotcode/modifiers/longname_modifiers.py similarity index 100% rename from packages/modifiers/robotcode/modifiers/longname_modifiers.py rename to packages/modifiers/src/robotcode/modifiers/longname_modifiers.py diff --git a/packages/modifiers/robotcode/modifiers/py.typed b/packages/modifiers/src/robotcode/modifiers/py.typed similarity index 100% rename from packages/modifiers/robotcode/modifiers/py.typed rename to packages/modifiers/src/robotcode/modifiers/py.typed diff --git a/packages/plugin/pyproject.toml b/packages/plugin/pyproject.toml index 78fe9c8ca..9267ef70d 100644 --- a/packages/plugin/pyproject.toml +++ b/packages/plugin/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-plugin" description = 'Some classes for RobotCode plugin management' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -36,15 +36,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/plugin/__version__.py" +path = "src/robotcode/plugin/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/plugin/robotcode/plugin/__version__.py b/packages/plugin/robotcode/plugin/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/plugin/robotcode/plugin/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/plugin/robotcode/plugin/__init__.py b/packages/plugin/src/robotcode/plugin/__init__.py similarity index 98% rename from packages/plugin/robotcode/plugin/__init__.py rename to packages/plugin/src/robotcode/plugin/__init__.py index 41ae39856..cc30a303d 100644 --- a/packages/plugin/robotcode/plugin/__init__.py +++ b/packages/plugin/src/robotcode/plugin/__init__.py @@ -5,7 +5,6 @@ import click import pluggy - from robotcode.core.dataclasses import as_json __all__ = ["hookimpl", "CommonConfig", "pass_application"] @@ -33,7 +32,7 @@ def __str__(self) -> str: @dataclass class CommonConfig: - config_file: Optional[Path] = None + config_files: Optional[List[Path]] = None profiles: Optional[List[str]] = None dry: bool = False verbose: bool = False diff --git a/packages/plugin/src/robotcode/plugin/__version__.py b/packages/plugin/src/robotcode/plugin/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/plugin/src/robotcode/plugin/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/plugin/robotcode/plugin/click_helper.py b/packages/plugin/src/robotcode/plugin/click_helper.py similarity index 100% rename from packages/plugin/robotcode/plugin/click_helper.py rename to packages/plugin/src/robotcode/plugin/click_helper.py diff --git a/packages/plugin/robotcode/plugin/manager.py b/packages/plugin/src/robotcode/plugin/manager.py similarity index 100% rename from packages/plugin/robotcode/plugin/manager.py rename to packages/plugin/src/robotcode/plugin/manager.py diff --git a/packages/plugin/robotcode/plugin/py.typed b/packages/plugin/src/robotcode/plugin/py.typed similarity index 100% rename from packages/plugin/robotcode/plugin/py.typed rename to packages/plugin/src/robotcode/plugin/py.typed diff --git a/packages/plugin/robotcode/plugin/specs.py b/packages/plugin/src/robotcode/plugin/specs.py similarity index 100% rename from packages/plugin/robotcode/plugin/specs.py rename to packages/plugin/src/robotcode/plugin/specs.py diff --git a/packages/robot/pyproject.toml b/packages/robot/pyproject.toml index 9e3f38e11..a185a764b 100644 --- a/packages/robot/pyproject.toml +++ b/packages/robot/pyproject.toml @@ -41,14 +41,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/robot/__version__.py" +path = "src/robotcode/robot/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/robot/robotcode/robot/__version__.py b/packages/robot/robotcode/robot/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/robot/robotcode/robot/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/robot/src/robotcode/robot/__version__.py b/packages/robot/src/robotcode/robot/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/robot/src/robotcode/robot/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/robot/robotcode/robot/config/__init__.py b/packages/robot/src/robotcode/robot/config/__init__.py similarity index 100% rename from packages/robot/robotcode/robot/config/__init__.py rename to packages/robot/src/robotcode/robot/config/__init__.py diff --git a/packages/robot/robotcode/robot/config/loader.py b/packages/robot/src/robotcode/robot/config/loader.py similarity index 98% rename from packages/robot/robotcode/robot/config/loader.py rename to packages/robot/src/robotcode/robot/config/loader.py index f81c4ca15..91fc9fd6c 100644 --- a/packages/robot/robotcode/robot/config/loader.py +++ b/packages/robot/src/robotcode/robot/config/loader.py @@ -52,7 +52,7 @@ def _load_config_data_from_path(__path: Path) -> RobotConfig: if __path.name == ROBOT_TOML or __path.name == LOCAL_ROBOT_TOML: return loads_config_from_robot_toml(__path.read_text("utf-8")) - raise ValueError(f"Unknown config file name: {__path.name}") + raise ValueError(f"Unknown config file type: {__path.name}") def load_config_from_path(*__paths: Union[Path, Tuple[Path, ConfigType]]) -> RobotConfig: diff --git a/packages/robot/robotcode/robot/config/model.py b/packages/robot/src/robotcode/robot/config/model.py similarity index 78% rename from packages/robot/robotcode/robot/config/model.py rename to packages/robot/src/robotcode/robot/config/model.py index 5849f9cb3..c45fe964a 100644 --- a/packages/robot/robotcode/robot/config/model.py +++ b/packages/robot/src/robotcode/robot/config/model.py @@ -1,16 +1,26 @@ -from __future__ import annotations - import dataclasses +import datetime import fnmatch import os import platform import re from dataclasses import dataclass from enum import Enum -from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, get_type_hints +from typing import ( + Any, + Callable, + Dict, + List, + Literal, + Optional, + Tuple, + Union, + get_type_hints, +) from robotcode.core.dataclasses import TypeValidationError, ValidateMixin, validate_types from robotcode.core.utils.safe_eval import safe_eval +from typing_extensions import Self class Flag(str, Enum): @@ -76,6 +86,115 @@ def field( return dataclasses.field(*args, **kwargs) +class EvaluationError(Exception): + """Evaluation error.""" + + def __init__(self, expression: str, message: str): + super().__init__(f"Evaluation of {repr(expression)} failed: {message}") + self.expr = expression + + +SAFE_GLOBALS = { + "environ": os.environ, + "re": re, + "platform": platform, + "datetime": datetime.datetime, + "date": datetime.date, + "time": datetime.time, + "timedelta": datetime.timedelta, + "timezone": datetime.timezone, +} + + +@dataclass +class Expression: + """Expression to evaluate.""" + + expr: str = field( + description="""\ + Condition to evaluate. This must be a Python "eval" expression. + For security reasons, only certain expressions and functions are allowed. + + Examples: + ```toml + if = "re.match(r'^\\d+$', environ.get('TEST_VAR', ''))" + if = "platform.system() == 'Linux'" + ``` + """, + no_default=True, + ) + + def evaluate(self) -> Any: + try: + return safe_eval(self.expr, SAFE_GLOBALS) + except Exception as e: + raise EvaluationError(self.expr, str(e)) from e + + +@dataclass +class StringExpression(Expression): + """Expression to evaluate to a string.""" + + def evaluate(self) -> str: + return str(super().evaluate()) + + +@dataclass +class Condition: + """Condition to evaluate.""" + + if_: str = field( + description="""\ + Condition to evaluate. This must be a Python "eval" expression. + For security reasons, only certain expressions and functions are allowed. + + Examples: + ```toml + if = "re.match(r'^\\d+$', environ.get('TEST_VAR', ''))" + if = "platform.system() == 'Linux'" + ``` + """, + alias="if", + no_default=True, + ) + + def evaluate(self) -> bool: + try: + return bool(safe_eval(self.if_, SAFE_GLOBALS)) + except Exception as e: + raise EvaluationError(self.if_, str(e)) from e + + +@dataclass() +class NamePattern(ValidateMixin): + """Name pattern to match.""" + + name: str = field( + description="""\ + Name pattern to match. This is a glob pattern, where ``*`` matches any number of characters + """, + no_default=True, + ) + + def __str__(self) -> str: + return f"name:{self.name}" + + +@dataclass() +class TagPattern(ValidateMixin): + """Tag pattern to match.""" + + tag: str = field( + description="""\ + Tag pattern to match. This is a glob pattern, where ``*`` matches any number of characters + """, + no_default=True, + ) + + def __str__(self) -> str: + return f"tag:{self.tag}" + + @dataclass class BaseOptions(ValidateMixin): @classmethod @@ -97,47 +216,47 @@ def build_command_line(self) -> List[str]: key=lambda f: f.metadata.get("robot_priority", 0), ) - def append_name(field: dataclasses.Field[Any], add_flag: Optional[str] = None) -> None: + def append_name(field: "dataclasses.Field[Any]", add_flag: Optional[str] = None) -> None: if "robot_short_name" in field.metadata: result.append(f"-{field.metadata['robot_short_name']}") elif "robot_name" in field.metadata: result.append(f"--{'no' if add_flag else ''}{field.metadata['robot_name']}") for field in sorted_fields: - value = getattr(self, field.name) - if value is None: - continue - - if field.metadata.get("robot_is_flag", False): - if value is None or value == Flag.DEFAULT: + try: + value = getattr(self, field.name) + if value is None: continue - append_name(field, bool(value) != field.metadata.get("robot_flag_default", True)) - - continue - - if isinstance(value, list): - for item in value: - append_name(field) - result.append(str(item)) - elif isinstance(value, dict): - for key, item in value.items(): - append_name(field) - if isinstance(item, list): - separator = ";" if any(True for s in item if ":" in s) else ":" - result.append(f"{key}{separator}{separator.join(item)}") - else: - result.append(f"{key}:{item}") - else: - if field.metadata.get("robot_name", "").startswith("+"): - if str(value) == "default": + if field.metadata.get("robot_is_flag", False): + if value is None or value == Flag.DEFAULT: continue - result.append(f"--{str(value)}") + append_name(field, bool(value) != field.metadata.get("robot_flag_default", True)) + continue - append_name(field) - result.append(str(value)) + if isinstance(value, list): + for item in value: + append_name(field) + if isinstance(item, dict): + for k, v in item.items(): + result.append(f"{k}:{v}") + else: + result.append(str(item)) + elif isinstance(value, dict): + for key, item in value.items(): + append_name(field) + if isinstance(item, list): + separator = ";" if any(True for s in item if ":" in s) else ":" + result.append(f"{key}{separator}{separator.join(item)}") + else: + result.append(f"{key}:{item}") + else: + append_name(field) + result.append(str(value)) + except EvaluationError as e: + raise ValueError(f"Evaluation of '{field.name}' failed: {str(e)}") from e return result @@ -148,7 +267,7 @@ def _verified_value(name: str, value: Any, types: Union[type, Tuple[type, ...]], raise TypeValidationError("Dataclass Type Validation Error", target=target, errors={name: errors}) return value - def add_options(self, config: RobotBaseProfile, combine_extras: bool = False) -> None: + def add_options(self, config: "BaseOptions", combine_extras: bool = False) -> None: type_hints = get_type_hints(type(self)) base_field_names = [f.name for f in dataclasses.fields(self)] @@ -198,6 +317,31 @@ def add_options(self, config: RobotBaseProfile, combine_extras: bool = False) -> if new is not None: setattr(self, f.name, new) + def evaluated(self) -> Self: + result = dataclasses.replace(self) + for f in dataclasses.fields(result): + try: + if isinstance(getattr(result, f.name), Expression): + setattr(result, f.name, getattr(result, f.name).evaluate()) + elif isinstance(getattr(result, f.name), list): + setattr( + result, + f.name, + [e.evaluate() if isinstance(e, Expression) else e for e in getattr(result, f.name)], + ) + elif isinstance(getattr(result, f.name), dict): + setattr( + result, + f.name, + { + k: e.evaluate() if isinstance(e, Expression) else e + for k, e in getattr(result, f.name).items() + }, + ) + except EvaluationError as e: + raise ValueError(f"Evaluation of '{f.name}' failed: {str(e)}") from e + return result + # start generated code @@ -206,8 +350,6 @@ def add_options(self, config: RobotBaseProfile, combine_extras: bool = False) -> class CommonOptions(BaseOptions): """Common options for all _robot_ commands.""" - # argumentfile - # console console_colors: Optional[Literal["auto", "on", "ansi", "off"]] = field( description="""\ Use colors on console output or not. @@ -223,10 +365,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="C", ) - # consolemarkers - # consolewidth - # debugfile - doc: Optional[str] = field( + doc: Optional[Union[str, StringExpression]] = field( description="""\ Set the documentation of the top level suite. Simple formatting is supported (e.g. *bold*). If the @@ -248,9 +387,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="D", ) - # dotted - # dryrun - excludes: Optional[List[str]] = field( + excludes: Optional[List[Union[str, StringExpression]]] = field( description="""\ Select test cases not to run by tag. These tests are not run even if included with --include. Tags are @@ -263,9 +400,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="e", ) - # exitonerror - # exitonfailure - expand_keywords: Optional[List[Union[str, Literal["name:", "tag:"]]]] = field( + expand_keywords: Optional[List[Union[NamePattern, TagPattern]]] = field( description="""\ Matching keywords will be automatically expanded in the log file. Matching against keyword name or tags @@ -284,9 +419,8 @@ class CommonOptions(BaseOptions): robot_name="expandkeywords", robot_priority=500, ) - # extension flatten_keywords: Optional[ - List[Union[str, Literal["for", "while", "iteration", "name:", "tag:"]]] + Optional[List[Union[str, Literal["for", "while", "iteration"], NamePattern, TagPattern]]] ] = field( description="""\ Flattens matching keywords in the generated log file. @@ -309,8 +443,7 @@ class CommonOptions(BaseOptions): robot_name="flattenkeywords", robot_priority=500, ) - # help - includes: Optional[List[str]] = field( + includes: Optional[List[Union[str, StringExpression]]] = field( description="""\ Select tests by tag. Similarly as name with --test, tag is case and space insensitive and it is possible @@ -332,9 +465,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="i", ) - # language - # listener - log: Optional[str] = field( + log: Optional[Union[str, StringExpression]] = field( description="""\ HTML log file. Can be disabled by giving a special value `NONE`. Default: log.html @@ -352,8 +483,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="l", ) - # loglevel - log_title: Optional[str] = field( + log_title: Optional[Union[str, StringExpression]] = field( description="""\ Title for the generated log file. The default title is ` Log`. @@ -364,9 +494,7 @@ class CommonOptions(BaseOptions): robot_name="logtitle", robot_priority=500, ) - # maxassignlength - # maxerrorlines - metadata: Optional[Dict[str, str]] = field( + metadata: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Set metadata of the top level suite. Value can contain formatting and be read from a file similarly @@ -379,7 +507,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="M", ) - name: Optional[str] = field( + name: Optional[Union[str, StringExpression]] = field( description="""\ Set the name of the top level suite. By default the name is created based on the executed file or @@ -405,8 +533,7 @@ class CommonOptions(BaseOptions): robot_is_flag=True, robot_flag_default=False, ) - # output - output_dir: Optional[str] = field( + output_dir: Optional[Union[str, StringExpression]] = field( description="""\ Where to create output files. The default is the directory where tests are run from and the given path @@ -419,7 +546,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="d", ) - pre_rebot_modifiers: Optional[Dict[str, List[str]]] = field( + pre_rebot_modifiers: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ Class to programmatically modify the result model before creating reports and logs. @@ -430,8 +557,7 @@ class CommonOptions(BaseOptions): robot_name="prerebotmodifier", robot_priority=500, ) - # prerunmodifier - python_path: Optional[List[str]] = field( + python_path: Optional[List[Union[str, StringExpression]]] = field( description="""\ Additional locations (directories, ZIPs) where to search libraries and other extensions when they are @@ -454,11 +580,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="P", ) - # quiet - # randomize - remove_keywords: Optional[ - List[Union[str, Literal["all", "passed", "for", "wuks", "name:", "tag:"]]] - ] = field( + remove_keywords: Optional[List[Union[Literal["all", "passed", "for", "wuks"], NamePattern, TagPattern]]] = field( description="""\ Remove keyword data from the generated log file. Keywords containing warnings are not removed except @@ -505,7 +627,7 @@ class CommonOptions(BaseOptions): robot_name="removekeywords", robot_priority=500, ) - report: Optional[str] = field( + report: Optional[Union[str, StringExpression]] = field( description="""\ HTML report file. Can be disabled with `NONE` similarly as --log. Default: report.html @@ -517,7 +639,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="r", ) - report_background: Optional[str] = field( + report_background: Optional[Union[str, StringExpression]] = field( description="""\ Background colors to use in the report file. Given in format `passed:failed:skipped` where the @@ -537,7 +659,7 @@ class CommonOptions(BaseOptions): robot_name="reportbackground", robot_priority=500, ) - report_title: Optional[str] = field( + report_title: Optional[Union[str, StringExpression]] = field( description="""\ Title for the generated report file. The default title is ` Report`. @@ -548,8 +670,6 @@ class CommonOptions(BaseOptions): robot_name="reporttitle", robot_priority=500, ) - # rerunfailed - # rerunfailedsuites rpa: Union[bool, Flag, None] = field( description="""\ Turn on the generic automation mode. Mainly affects @@ -564,8 +684,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - # runemptysuite - set_tag: Optional[List[str]] = field( + set_tag: Optional[List[Union[str, StringExpression]]] = field( description="""\ Sets given tag(s) to all executed tests. @@ -576,9 +695,6 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_short_name="G", ) - # skip - # skiponfailure - # skipteardownonexit split_log: Union[bool, Flag, None] = field( description="""\ Split the log file into smaller pieces that open in @@ -591,7 +707,7 @@ class CommonOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - suites: Optional[List[str]] = field( + suites: Optional[List[Union[str, StringExpression]]] = field( description="""\ Select suites by name. When this option is used with --test, --include or --exclude, only tests in @@ -620,7 +736,7 @@ class CommonOptions(BaseOptions): robot_name="suitestatlevel", robot_priority=500, ) - tag_doc: Optional[Dict[str, str]] = field( + tag_doc: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Add documentation to tags matching the given pattern. Documentation is shown in `Test Details` and @@ -641,7 +757,7 @@ class CommonOptions(BaseOptions): robot_name="tagdoc", robot_priority=500, ) - tag_stat_combine: Optional[Dict[str, str]] = field( + tag_stat_combine: Optional[List[Union[str, Dict[str, str]]]] = field( description="""\ Create combined statistics based on tags. These statistics are added into `Statistics by Tag`. @@ -662,7 +778,7 @@ class CommonOptions(BaseOptions): robot_name="tagstatcombine", robot_priority=500, ) - tag_stat_exclude: Optional[List[str]] = field( + tag_stat_exclude: Optional[List[Union[str, StringExpression]]] = field( description="""\ Exclude matching tags from `Statistics by Tag`. This option can be used with --tagstatinclude @@ -674,7 +790,7 @@ class CommonOptions(BaseOptions): robot_name="tagstatexclude", robot_priority=500, ) - tag_stat_include: Optional[List[str]] = field( + tag_stat_include: Optional[List[Union[str, StringExpression]]] = field( description="""\ Include only matching tags in `Statistics by Tag` in log and report. By default all tags are shown. @@ -686,7 +802,7 @@ class CommonOptions(BaseOptions): robot_name="tagstatinclude", robot_priority=500, ) - tag_stat_link: Optional[Dict[str, str]] = field( + tag_stat_link: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Add external links into `Statistics by Tag`. Pattern can use `*`, `?` and `[]` as wildcards @@ -707,7 +823,7 @@ class CommonOptions(BaseOptions): robot_name="tagstatlink", robot_priority=500, ) - tasks: Optional[List[str]] = field( + tasks: Optional[List[Union[str, StringExpression]]] = field( description="""\ Alias to --test. Especially applicable with --rpa. @@ -717,7 +833,7 @@ class CommonOptions(BaseOptions): robot_name="task", robot_priority=500, ) - tests: Optional[List[str]] = field( + tests: Optional[List[Union[str, StringExpression]]] = field( description="""\ Select tests by name or by long name containing also parent suite name like `Parent.Test`. Name is case @@ -750,9 +866,7 @@ class CommonOptions(BaseOptions): robot_short_name="T", robot_is_flag=True, ) - # variable - # variablefile - xunit: Optional[str] = field( + xunit: Optional[Union[str, StringExpression]] = field( description="""\ xUnit compatible result file. Not created unless this option is specified. @@ -770,7 +884,7 @@ class CommonOptions(BaseOptions): class CommonExtraOptions(BaseOptions): """Extra common options for all _robot_ commands.""" - extra_excludes: Optional[List[str]] = field( + extra_excludes: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --exclude option. @@ -784,7 +898,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `-e --exclude tag *` option of _robot_ """, ) - extra_expand_keywords: Optional[List[Union[str, Literal["name:", "tag:"]]]] = field( + extra_expand_keywords: Optional[List[Union[NamePattern, TagPattern]]] = field( description="""\ Appends entries to the --expandkeywords option. @@ -806,7 +920,7 @@ class CommonExtraOptions(BaseOptions): """, ) extra_flatten_keywords: Optional[ - List[Union[str, Literal["for", "while", "iteration", "name:", "tag:"]]] + Optional[List[Union[str, Literal["for", "while", "iteration"], NamePattern, TagPattern]]] ] = field( description="""\ Appends entries to the --flattenkeywords option. @@ -831,7 +945,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--flattenkeywords for|while|iteration|name:|tag: *` option of _robot_ """, ) - extra_includes: Optional[List[str]] = field( + extra_includes: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --include option. @@ -854,7 +968,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `-i --include tag *` option of _robot_ """, ) - extra_metadata: Optional[Dict[str, str]] = field( + extra_metadata: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Appends entries to the --metadata option. @@ -868,7 +982,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `-M --metadata name:value *` option of _robot_ """, ) - extra_pre_rebot_modifiers: Optional[Dict[str, List[str]]] = field( + extra_pre_rebot_modifiers: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ Appends entries to the --prerebotmodifier option. @@ -881,7 +995,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--prerebotmodifier class *` option of _robot_ """, ) - extra_python_path: Optional[List[str]] = field( + extra_python_path: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --pythonpath option. @@ -906,7 +1020,7 @@ class CommonExtraOptions(BaseOptions): """, ) extra_remove_keywords: Optional[ - List[Union[str, Literal["all", "passed", "for", "wuks", "name:", "tag:"]]] + List[Union[Literal["all", "passed", "for", "wuks"], NamePattern, TagPattern]] ] = field( description="""\ Appends entries to the --removekeywords option. @@ -956,7 +1070,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--removekeywords all|passed|for|wuks|name:|tag: *` option of _robot_ """, ) - extra_set_tag: Optional[List[str]] = field( + extra_set_tag: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --settag option. @@ -968,7 +1082,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `-G --settag tag *` option of _robot_ """, ) - extra_suites: Optional[List[str]] = field( + extra_suites: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --suite option. @@ -986,7 +1100,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `-s --suite name *` option of _robot_ """, ) - extra_tag_doc: Optional[Dict[str, str]] = field( + extra_tag_doc: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Appends entries to the --tagdoc option. @@ -1009,7 +1123,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--tagdoc pattern:doc *` option of _robot_ """, ) - extra_tag_stat_combine: Optional[Dict[str, str]] = field( + extra_tag_stat_combine: Optional[List[Union[str, Dict[str, str]]]] = field( description="""\ Appends entries to the --tagstatcombine option. @@ -1032,7 +1146,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--tagstatcombine tags:name *` option of _robot_ """, ) - extra_tag_stat_exclude: Optional[List[str]] = field( + extra_tag_stat_exclude: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --tagstatexclude option. @@ -1046,7 +1160,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--tagstatexclude tag *` option of _robot_ """, ) - extra_tag_stat_include: Optional[List[str]] = field( + extra_tag_stat_include: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --tagstatinclude option. @@ -1060,7 +1174,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--tagstatinclude tag *` option of _robot_ """, ) - extra_tag_stat_link: Optional[Dict[str, str]] = field( + extra_tag_stat_link: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Appends entries to the --tagstatlink option. @@ -1083,7 +1197,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--tagstatlink pattern:link:title *` option of _robot_ """, ) - extra_tasks: Optional[List[str]] = field( + extra_tasks: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --task option. @@ -1095,7 +1209,7 @@ class CommonExtraOptions(BaseOptions): corresponds to the `--task name *` option of _robot_ """, ) - extra_tests: Optional[List[str]] = field( + extra_tests: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --test option. @@ -1118,7 +1232,6 @@ class CommonExtraOptions(BaseOptions): class RobotOptions(BaseOptions): """Options for _robot_ command.""" - # argumentfile console: Optional[Literal["verbose", "dotted", "skipped", "quiet", "none"]] = field( description="""\ How to report execution on the console. @@ -1134,7 +1247,6 @@ class RobotOptions(BaseOptions): robot_name="console", robot_priority=500, ) - # consolecolors console_markers: Optional[Literal["auto", "on", "off"]] = field( description="""\ Show markers on the console when top level @@ -1159,7 +1271,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="W", ) - debug_file: Optional[str] = field( + debug_file: Optional[Union[str, StringExpression]] = field( description="""\ Debug file written during execution. Not created unless this option is specified. @@ -1171,7 +1283,6 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="b", ) - # doc dotted: Union[bool, Flag, None] = field( description="""\ Shortcut for `--console dotted`. @@ -1196,7 +1307,6 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - # exclude exit_on_error: Union[bool, Flag, None] = field( description="""\ Stops test execution if any error occurs when parsing @@ -1221,8 +1331,7 @@ class RobotOptions(BaseOptions): robot_short_name="X", robot_is_flag=True, ) - # expandkeywords - extensions: Optional[str] = field( + extensions: Optional[Union[str, StringExpression]] = field( description="""\ Parse only files with this extension when executing a directory. Has no effect when running individual @@ -1245,10 +1354,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="F", ) - # flattenkeywords - # help - # include - languages: Optional[List[str]] = field( + languages: Optional[List[Union[str, StringExpression]]] = field( description="""\ Activate localization. `lang` can be a name or a code of a built-in language, or a path or a module name of @@ -1260,7 +1366,7 @@ class RobotOptions(BaseOptions): robot_name="language", robot_priority=500, ) - listeners: Optional[Dict[str, List[str]]] = field( + listeners: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ A class for monitoring test execution. Gets notifications e.g. when tests start and end. @@ -1280,8 +1386,7 @@ class RobotOptions(BaseOptions): robot_name="listener", robot_priority=500, ) - # log - log_level: Optional[str] = field( + log_level: Optional[Union[str, StringExpression]] = field( description="""\ Threshold level for logging. Available levels: TRACE, DEBUG, INFO (default), WARN, NONE (no logging). Use @@ -1302,7 +1407,6 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="L", ) - # logtitle max_assign_length: Optional[int] = field( description="""\ Maximum number of characters to show in log @@ -1328,10 +1432,7 @@ class RobotOptions(BaseOptions): robot_name="maxerrorlines", robot_priority=500, ) - # metadata - # name - # statusrc - output: Optional[str] = field( + output: Optional[Union[str, StringExpression]] = field( description="""\ XML output file. Given path, similarly as paths given to --log, --report, --xunit, and --debugfile, is @@ -1349,9 +1450,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="o", ) - # outputdir - # prerebotmodifier - pre_run_modifiers: Optional[Dict[str, List[str]]] = field( + pre_run_modifiers: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ Class to programmatically modify the suite structure before execution. @@ -1362,7 +1461,6 @@ class RobotOptions(BaseOptions): robot_name="prerunmodifier", robot_priority=500, ) - # pythonpath quiet: Union[bool, Flag, None] = field( description="""\ Shortcut for `--console quiet`. @@ -1374,7 +1472,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - randomize: Optional[Optional[Union[str, Literal["all", "suites", "tests", "none"]]]] = field( + randomize: Optional[Union[str, Literal["all", "suites", "tests", "none"]]] = field( description="""\ Randomizes the test execution order. all: randomizes both suites and tests @@ -1397,11 +1495,7 @@ class RobotOptions(BaseOptions): robot_name="randomize", robot_priority=500, ) - # removekeywords - # report - # reportbackground - # reporttitle - re_run_failed: Optional[str] = field( + re_run_failed: Optional[Union[str, StringExpression]] = field( description="""\ Select failed tests from an earlier output file to be re-executed. Equivalent to selecting same tests @@ -1414,7 +1508,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="R", ) - re_run_failed_suites: Optional[str] = field( + re_run_failed_suites: Optional[Union[str, StringExpression]] = field( description="""\ Select failed suites from an earlier output file to be re-executed. @@ -1426,7 +1520,6 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="S", ) - # rpa run_empty_suite: Union[bool, Flag, None] = field( description="""\ Executes suite even if it contains no tests. Useful @@ -1440,8 +1533,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - # settag - skip: Optional[List[str]] = field( + skip: Optional[List[Union[str, StringExpression]]] = field( description="""\ Tests having given tag will be skipped. Tag can be a pattern. @@ -1452,7 +1544,7 @@ class RobotOptions(BaseOptions): robot_name="skip", robot_priority=500, ) - skip_on_failure: Optional[List[str]] = field( + skip_on_failure: Optional[List[Union[str, StringExpression]]] = field( description="""\ Tests having given tag will be skipped if they fail. Tag can be a pattern @@ -1475,18 +1567,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - # splitlog - # suite - # suitestatlevel - # tagdoc - # tagstatcombine - # tagstatexclude - # tagstatinclude - # tagstatlink - # task - # test - # timestampoutputs - variables: Optional[Dict[str, str]] = field( + variables: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Set variables in the test data. Only scalar variables with string value are supported and name is @@ -1508,7 +1589,7 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="v", ) - variable_files: Optional[List[str]] = field( + variable_files: Optional[List[Union[str, StringExpression]]] = field( description="""\ Python or YAML file file to read variables from. Possible arguments to the variable file can be given @@ -1528,14 +1609,13 @@ class RobotOptions(BaseOptions): robot_priority=500, robot_short_name="V", ) - # xunit @dataclass class RobotExtraOptions(BaseOptions): """Extra options for _robot_ command.""" - extra_languages: Optional[List[str]] = field( + extra_languages: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --language option. @@ -1549,7 +1629,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `--language lang *` option of _robot_ """, ) - extra_listeners: Optional[Dict[str, List[str]]] = field( + extra_listeners: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ Appends entries to the --listener option. @@ -1571,7 +1651,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `--listener class *` option of _robot_ """, ) - extra_pre_run_modifiers: Optional[Dict[str, List[str]]] = field( + extra_pre_run_modifiers: Optional[Dict[str, List[Union[str, StringExpression]]]] = field( description="""\ Appends entries to the --prerunmodifier option. @@ -1584,7 +1664,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `--prerunmodifier class *` option of _robot_ """, ) - extra_skip: Optional[List[str]] = field( + extra_skip: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --skip option. @@ -1597,7 +1677,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `--skip tag *` option of _robot_ """, ) - extra_skip_on_failure: Optional[List[str]] = field( + extra_skip_on_failure: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --skiponfailure option. @@ -1610,7 +1690,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `--skiponfailure tag *` option of _robot_ """, ) - extra_variables: Optional[Dict[str, str]] = field( + extra_variables: Optional[Dict[str, Union[str, StringExpression]]] = field( description="""\ Appends entries to the --variable option. @@ -1633,7 +1713,7 @@ class RobotExtraOptions(BaseOptions): corresponds to the `-v --variable name:value *` option of _robot_ """, ) - extra_variable_files: Optional[List[str]] = field( + extra_variable_files: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --variablefile option. @@ -1660,10 +1740,7 @@ class RobotExtraOptions(BaseOptions): class RebotOptions(BaseOptions): """Options for _rebot_ command.""" - # argumentfile - # consolecolors - # doc - end_time: Optional[str] = field( + end_time: Optional[Union[str, StringExpression]] = field( description="""\ Same as --starttime but for end time. If both options are used, elapsed time of the suite is calculated @@ -1677,13 +1754,7 @@ class RebotOptions(BaseOptions): robot_name="endtime", robot_priority=500, ) - # exclude - # expandkeywords - # flattenkeywords - # help - # include - # log - log_level: Optional[str] = field( + log_level: Optional[Union[str, StringExpression]] = field( description="""\ Threshold for selecting messages. Available levels: TRACE (default), DEBUG, INFO, WARN, NONE (no msgs). @@ -1704,7 +1775,6 @@ class RebotOptions(BaseOptions): robot_priority=500, robot_short_name="L", ) - # logtitle merge: Union[bool, Flag, None] = field( description="""\ When combining results, merge outputs together @@ -1719,10 +1789,7 @@ class RebotOptions(BaseOptions): robot_short_name="R", robot_is_flag=True, ) - # metadata - # name - # statusrc - output: Optional[str] = field( + output: Optional[Union[str, StringExpression]] = field( description="""\ XML output file. Not created unless this option is specified. Given path, similarly as paths given to @@ -1736,8 +1803,6 @@ class RebotOptions(BaseOptions): robot_priority=500, robot_short_name="o", ) - # outputdir - # prerebotmodifier process_empty_suite: Union[bool, Flag, None] = field( description="""\ Processes output also if the top level suite is @@ -1752,15 +1817,7 @@ class RebotOptions(BaseOptions): robot_priority=500, robot_is_flag=True, ) - # pythonpath - # removekeywords - # report - # reportbackground - # reporttitle - # rpa - # settag - # splitlog - start_time: Optional[str] = field( + start_time: Optional[Union[str, StringExpression]] = field( description="""\ Set execution start time. Timestamp must be given in format `2007-10-01 15:12:42.268` where all separators @@ -1777,17 +1834,6 @@ class RebotOptions(BaseOptions): robot_name="starttime", robot_priority=500, ) - # suite - # suitestatlevel - # tagdoc - # tagstatcombine - # tagstatexclude - # tagstatinclude - # tagstatlink - # task - # test - # timestampoutputs - # xunit @dataclass @@ -1824,7 +1870,7 @@ class LibDocOptions(BaseOptions): robot_priority=500, robot_short_name="f", ) - name: Optional[str] = field( + name: Optional[Union[str, StringExpression]] = field( description="""\ Sets the name of the documented library or resource. @@ -1835,7 +1881,7 @@ class LibDocOptions(BaseOptions): robot_priority=500, robot_short_name="n", ) - python_path: Optional[List[str]] = field( + python_path: Optional[List[Union[str, StringExpression]]] = field( description="""\ Additional locations where to search for libraries and resources. @@ -1887,14 +1933,13 @@ class LibDocOptions(BaseOptions): robot_name="theme", robot_priority=500, ) - # version @dataclass class LibDocExtraOptions(BaseOptions): - """Options for _libdoc_ command.""" + """Extra options for _libdoc_ command.""" - extra_python_path: Optional[List[str]] = field( + extra_python_path: Optional[List[Union[str, StringExpression]]] = field( description="""\ Appends entries to the --pythonpath option. @@ -1909,17 +1954,207 @@ class LibDocExtraOptions(BaseOptions): ) +@dataclass +class TestDocOptions(BaseOptions): + """Options for _testdoc_ command.""" + + doc: Optional[Union[str, StringExpression]] = field( + description="""\ + Override the documentation of the top level suite. + + --- + corresponds to the `-D --doc document` option of _robot_ + """, + robot_name="doc", + robot_priority=500, + robot_short_name="D", + ) + excludes: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Exclude tests by tags. + + --- + corresponds to the `-e --exclude tag *` option of _robot_ + """, + robot_name="exclude", + robot_priority=500, + robot_short_name="e", + ) + includes: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Include tests by tags. + + --- + corresponds to the `-i --include tag *` option of _robot_ + """, + robot_name="include", + robot_priority=500, + robot_short_name="i", + ) + metadata: Optional[Dict[str, Union[str, StringExpression]]] = field( + description="""\ + Set/override metadata of the top level suite. + + --- + corresponds to the `-M --metadata name:value *` option of _robot_ + """, + robot_name="metadata", + robot_priority=500, + robot_short_name="M", + ) + name: Optional[Union[str, StringExpression]] = field( + description="""\ + Override the name of the top level suite. + + --- + corresponds to the `-N --name name` option of _robot_ + """, + robot_name="name", + robot_priority=500, + robot_short_name="N", + ) + set_tag: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Set given tag(s) to all test cases. + + --- + corresponds to the `-G --settag tag *` option of _robot_ + """, + robot_name="settag", + robot_priority=500, + robot_short_name="G", + ) + suites: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Include suites by name. + + --- + corresponds to the `-s --suite name *` option of _robot_ + """, + robot_name="suite", + robot_priority=500, + robot_short_name="s", + ) + tests: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Include tests by name. + + --- + corresponds to the `-t --test name *` option of _robot_ + """, + robot_name="test", + robot_priority=500, + robot_short_name="t", + ) + title: Optional[Union[str, StringExpression]] = field( + description="""\ + Set the title of the generated documentation. + Underscores in the title are converted to spaces. + The default title is the name of the top level suite. + + --- + corresponds to the `-T --title title` option of _robot_ + """, + robot_name="title", + robot_priority=500, + robot_short_name="T", + ) + + +@dataclass +class TestDocExtraOptions(BaseOptions): + """Extra options for _testdoc_ command.""" + + extra_excludes: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --exclude option. + + --- + + Exclude tests by tags. + + --- + corresponds to the `-e --exclude tag *` option of _robot_ + """, + ) + extra_includes: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --include option. + + --- + + Include tests by tags. + + --- + corresponds to the `-i --include tag *` option of _robot_ + """, + ) + extra_metadata: Optional[Dict[str, Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --metadata option. + + --- + + Set/override metadata of the top level suite. + + --- + corresponds to the `-M --metadata name:value *` option of _robot_ + """, + ) + extra_set_tag: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --settag option. + + --- + + Set given tag(s) to all test cases. + + --- + corresponds to the `-G --settag tag *` option of _robot_ + """, + ) + extra_suites: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --suite option. + + --- + + Include suites by name. + + --- + corresponds to the `-s --suite name *` option of _robot_ + """, + ) + extra_tests: Optional[List[Union[str, StringExpression]]] = field( + description="""\ + Appends entries to the --test option. + + --- + + Include tests by name. + + --- + corresponds to the `-t --test name *` option of _robot_ + """, + ) + + # end generated code @dataclass class RebotProfile(RebotOptions, CommonOptions, CommonExtraOptions): - pass + """Profile for _rebot_ command.""" @dataclass class LibDocProfile(LibDocOptions, LibDocExtraOptions): - pass + """Profile for _libdoc_ command.""" + + +@dataclass +class TestDocProfile(TestDocOptions, TestDocExtraOptions): + """Profile for _testdoc_ command.""" @dataclass @@ -1976,6 +2211,12 @@ class RobotBaseProfile(CommonOptions, CommonExtraOptions, RobotOptions, RobotExt """ ) + testdoc: Optional[TestDocProfile] = field( + description="""\ + Options to be passed to _testdoc_. + """ + ) + @dataclass class RobotExtraBaseProfile(RobotBaseProfile): @@ -2005,38 +2246,6 @@ class RobotExtraBaseProfile(RobotBaseProfile): ) -class EvaluationError(Exception): - """Evaluation error.""" - - def __init__(self, expression: str, message: str): - super().__init__(f"Evaluation of '{expression}' failed: {message}") - self.expr = expression - - -@dataclass -class Condition: - if_: str = field( - description="""\ - Condition to evaluate. This must be a Python "eval" expression. - For security reasons, only certain expressions and functions are allowed. - - Examples: - ```toml - if = "re.match(r'^\\d+$', environ.get('TEST_VAR', ''))" - if = "platform.system() == 'Linux'" - ``` - """, - alias="if", - no_default=True, - ) - - def evaluate(self) -> bool: - try: - return bool(safe_eval(self.if_, {"env": os.environ, "re": re, "platform": platform})) - except Exception as e: - raise EvaluationError(self.if_, str(e)) from e - - @dataclass class RobotProfile(RobotExtraBaseProfile): """Robot Framework configuration profile.""" @@ -2063,27 +2272,33 @@ class RobotProfile(RobotExtraBaseProfile): ```toml # enabled if TEST_VAR is set - enabled = { if = 'env.get("CI") == "true"' } + enabled = { if = 'environ.get("CI") == "true"' } ``` """ ) + precedence: Optional[int] = field( + description="""\ + Precedence of the profile. Lower values are executed first. If not set the order is undefined. + """ + ) + @dataclass class RobotConfig(RobotExtraBaseProfile): """Robot Framework configuration.""" - default_profile: Union[str, List[str], None] = field( + default_profiles: Union[str, List[str], None] = field( description="""\ Selects the Default profile if no profile is given at command line. Examples: ```toml - default_profile = "default" + default_profiles = "default" ``` ```toml - default_profile = ["default", "Firefox"] + default_profiles = ["default", "Firefox"] ``` """, ) @@ -2098,33 +2313,24 @@ class RobotConfig(RobotExtraBaseProfile): metadata={"description": "Tool configuration."}, ) - def combine_profiles(self, *names: str, verbose_callback: Callable[..., None] = None) -> RobotBaseProfile: - type_hints = get_type_hints(RobotBaseProfile) - base_field_names = [f.name for f in dataclasses.fields(RobotBaseProfile)] - - result = RobotBaseProfile( - **{ - f.name: self._verified_value(f.name, new, type_hints[f.name], self) - for f in dataclasses.fields(RobotBaseProfile) - if (new := getattr(self, f.name)) is not None - } - ) + def select_profiles(self, *names: str, verbose_callback: Callable[..., None] = None) -> Dict[str, RobotProfile]: + result: Dict[str, RobotProfile] = {} profiles = self.profiles or {} if not names: if verbose_callback: - verbose_callback('No profiles given, try to check if there are default profiles specified".') + verbose_callback("No profiles given, try to check if there are default profiles specified.") - default_profile = [self.default_profile] if isinstance(self.default_profile, str) else self.default_profile + default_profile = ( + [self.default_profiles] if isinstance(self.default_profiles, str) else self.default_profiles + ) if verbose_callback and default_profile: verbose_callback(f"Using default profiles: {', '.join( default_profile)}.") names = (*(default_profile or ()),) - selected_profiles: List[str] = [] - for name in names: profile_names = [p for p in profiles.keys() if fnmatch.fnmatchcase(p, name)] @@ -2132,16 +2338,30 @@ def combine_profiles(self, *names: str, verbose_callback: Callable[..., None] = raise ValueError(f"Can't find any profiles matching the pattern '{name}''.") for v in profile_names: - if v in selected_profiles: - continue - selected_profiles.append(v) + result.update({v: profiles[v]}) - if verbose_callback: - verbose_callback(f"Select profiles {', '.join(selected_profiles)}") + return result - for profile_name in selected_profiles: - profile = profiles[profile_name] + def combine_profiles(self, *names: str, verbose_callback: Callable[..., None] = None) -> RobotBaseProfile: + type_hints = get_type_hints(RobotBaseProfile) + base_field_names = [f.name for f in dataclasses.fields(RobotBaseProfile)] + result = RobotBaseProfile( + **{ + f.name: self._verified_value(f.name, new, type_hints[f.name], self) + for f in dataclasses.fields(RobotBaseProfile) + if (new := getattr(self, f.name)) is not None + } + ) + + selected_profiles = self.select_profiles(*names, verbose_callback=verbose_callback) + if verbose_callback: + if selected_profiles: + verbose_callback(f"Select profiles: {', '.join(selected_profiles.keys())}") + else: + verbose_callback("No profiles selected.") + + for profile_name, profile in sorted(selected_profiles.items(), key=lambda x: x[1].precedence or 0): try: if profile.enabled is not None and ( isinstance(profile.enabled, Condition) and not profile.enabled.evaluate() or not profile.enabled @@ -2150,9 +2370,7 @@ def combine_profiles(self, *names: str, verbose_callback: Callable[..., None] = verbose_callback(f'Skipping profile "{profile_name}" because it\'s disabled.') continue except EvaluationError as e: - if verbose_callback: - verbose_callback(f'Skipping profile "{profile_name}" because: {e}') - continue + raise ValueError(f'Error evaluating "enabled" condition for profile "{profile_name}": {e}') from e if verbose_callback: verbose_callback(f'Using profile "{profile_name}".') diff --git a/packages/robot/src/robotcode/robot/config/utils.py b/packages/robot/src/robotcode/robot/config/utils.py new file mode 100644 index 000000000..c856fc05d --- /dev/null +++ b/packages/robot/src/robotcode/robot/config/utils.py @@ -0,0 +1,50 @@ +from pathlib import Path +from typing import Callable, Optional, Sequence, Tuple, Union + +from .loader import ( + ConfigType, + DiscoverdBy, + find_project_root, + get_config_files_from_folder, +) + + +def get_config_files( + paths: Optional[Sequence[Union[str, Path]]] = None, + config_files: Optional[Sequence[Path]] = None, + *, + raise_on_error: bool = True, + verbose_callback: Optional[Callable[[str], None]] = None, +) -> Tuple[Sequence[Tuple[Path, ConfigType]], Optional[Path], DiscoverdBy]: + root_folder, discovered_by = find_project_root(*(paths or [])) + + if root_folder is None: + if raise_on_error: + raise FileNotFoundError("Cannot detect root folder for project. 😥") + if verbose_callback: + verbose_callback("Cannot detect root folder for project. 😥") + return [], None, DiscoverdBy.NOT_FOUND + + if verbose_callback: + verbose_callback(f"Found project root at:\n {root_folder} ({discovered_by.value})") + + if config_files: + if verbose_callback: + verbose_callback("Using config file:" + "\n ".join(str(config_files))) + + return [(f, ConfigType.CUSTOM_TOML) for f in config_files], root_folder, discovered_by + + result = get_config_files_from_folder(root_folder) + + if not result and raise_on_error: + raise FileNotFoundError("Cannot find any configuration file. 😥") + + if verbose_callback: + if result: + verbose_callback( + "Found configuration files:\n " + "\n ".join(str(f[0]) for f in result), + ) + else: + verbose_callback("No configuration files found.") + + return result, root_folder, discovered_by diff --git a/packages/robot/robotcode/robot/py.typed b/packages/robot/src/robotcode/robot/py.typed similarity index 100% rename from packages/robot/robotcode/robot/py.typed rename to packages/robot/src/robotcode/robot/py.typed diff --git a/packages/runner/pyproject.toml b/packages/runner/pyproject.toml index 56f8280df..3dccd55c5 100644 --- a/packages/runner/pyproject.toml +++ b/packages/runner/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "robotcode-runner" description = 'RobotCode runner plugin for Robot Framework' -readme = {"file" = "README.md", "content-type" = "text/markdown"} +readme = { "file" = "README.md", "content-type" = "text/markdown" } requires-python = ">=3.8" license = "Apache-2.0" keywords = [] @@ -29,7 +29,7 @@ dependencies = [ "robotframework>=4.1.0", "robotcode-plugin", "robotcode-robot", - "robotcode" + "robotcode", ] dynamic = ["version"] @@ -45,15 +45,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues" Source = "https://github.com/d-biehl/robotcode" [tool.hatch.version] -path = "robotcode/runner/__version__.py" +path = "src/robotcode/runner/__version__.py" -[tool.hatch.envs.build] -detached = true -python = "38" +[tool.hatch.build] +dev-mode-dirs = ["src"] +[tool.hatch.build.targets.wheel] +only-include = ["src/robotcode"] +sources = ["src"] [tool.hatch.build.targets.sdist] -only-include = ["robotcode"] +only-include = ["src"] -[tool.hatch.build.targets.wheel] -only-include = ["robotcode"] +[tool.hatch.envs.build] +detached = true +python = "38" diff --git a/packages/runner/robotcode/runner/__version__.py b/packages/runner/robotcode/runner/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/packages/runner/robotcode/runner/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/packages/runner/robotcode/runner/cli/__init__.py b/packages/runner/robotcode/runner/cli/__init__.py deleted file mode 100644 index b55ad7cec..000000000 --- a/packages/runner/robotcode/runner/cli/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .libdoc import libdoc -from .rebot import rebot -from .robot import robot - -__all__ = ["robot", "libdoc", "rebot"] diff --git a/packages/runner/robotcode/runner/__init__.py b/packages/runner/src/robotcode/runner/__init__.py similarity index 100% rename from packages/runner/robotcode/runner/__init__.py rename to packages/runner/src/robotcode/runner/__init__.py diff --git a/packages/runner/robotcode/runner/__main__.py b/packages/runner/src/robotcode/runner/__main__.py similarity index 100% rename from packages/runner/robotcode/runner/__main__.py rename to packages/runner/src/robotcode/runner/__main__.py diff --git a/packages/runner/src/robotcode/runner/__version__.py b/packages/runner/src/robotcode/runner/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/packages/runner/src/robotcode/runner/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/packages/runner/src/robotcode/runner/cli/__init__.py b/packages/runner/src/robotcode/runner/cli/__init__.py new file mode 100644 index 000000000..bae0894eb --- /dev/null +++ b/packages/runner/src/robotcode/runner/cli/__init__.py @@ -0,0 +1,6 @@ +from .libdoc import libdoc +from .rebot import rebot +from .robot import robot +from .testdoc import testdoc + +__all__ = ["robot", "libdoc", "rebot", "testdoc"] diff --git a/packages/runner/robotcode/runner/cli/libdoc.py b/packages/runner/src/robotcode/runner/cli/libdoc.py similarity index 68% rename from packages/runner/robotcode/runner/cli/libdoc.py rename to packages/runner/src/robotcode/runner/cli/libdoc.py index 45784c8d6..30f388b5c 100644 --- a/packages/runner/robotcode/runner/cli/libdoc.py +++ b/packages/runner/src/robotcode/runner/cli/libdoc.py @@ -6,10 +6,10 @@ from robot.errors import DataError, Information from robot.libdoc import USAGE, LibDoc from robot.version import get_full_version - from robotcode.plugin import Application, pass_application -from robotcode.robot.config.loader import find_project_root, get_config_files_from_folder, load_config_from_path -from robotcode.robot.config.model import LibDocProfile, RobotBaseProfile +from robotcode.robot.config.loader import load_config_from_path +from robotcode.robot.config.model import LibDocProfile +from robotcode.robot.config.utils import get_config_files from ..__version__ import __version__ @@ -27,7 +27,7 @@ def parse_arguments(self, cli_args: Any) -> Any: line_end = "\n" raise Information( "Dry run, not executing any commands. " - f"Would execute libdoc with the following arguments:\n" + f"Would execute libdoc with the following options and arguments:\n" f'{line_end.join((*(f"{k} = {repr(v)}" for k, v in options.items()) ,*arguments))}' ) @@ -72,28 +72,17 @@ def libdoc( except (DataError, Information): pass - root_folder, discovered_by = find_project_root(*(robot_arguments or [])) - app.verbose(lambda: f"Found project root at:\n {root_folder} ({discovered_by.value})") - - profile: Optional[RobotBaseProfile] = None - - if root_folder is not None: - config_files = get_config_files_from_folder(root_folder) - if config_files: - app.verbose(lambda: f"Found configuration files:\n {', '.join(str(f[0]) for f in config_files)}") - try: - profile = load_config_from_path(*config_files).combine_profiles( - *app.config.profiles if app.config.profiles else [], - verbose_callback=app.verbose if app.config.verbose else None, - ) - except (TypeError, ValueError) as e: - raise click.ClickException(str(e)) from e - - else: - app.verbose("No configuration files found.") - - if profile is None: - profile = RobotBaseProfile() + config_files, root_folder, _ = get_config_files( + robot_arguments, app.config.config_files, raise_on_error=False, verbose_callback=app.verbose + ) + try: + profile = ( + load_config_from_path(*config_files) + .combine_profiles(*(app.config.profiles or []), verbose_callback=app.verbose) + .evaluated() + ) + except (TypeError, ValueError) as e: + raise click.ClickException(str(e)) from e libdoc_options = profile.libdoc if libdoc_options is None: @@ -107,9 +96,10 @@ def libdoc( for k, v in profile.env.items(): os.environ[k] = v app.verbose(lambda: f"Set environment variable {k} to {v}") + try: app.verbose( - lambda: " Executing robot with the following options:\n " + lambda: "Executing libdoc robot with the following options:\n " + " ".join(f'"{o}"' for o in (options + list(robot_options_and_args))) ) return cast( diff --git a/packages/runner/robotcode/runner/cli/rebot.py b/packages/runner/src/robotcode/runner/cli/rebot.py similarity index 67% rename from packages/runner/robotcode/runner/cli/rebot.py rename to packages/runner/src/robotcode/runner/cli/rebot.py index 2b03eeaaa..239c01644 100644 --- a/packages/runner/robotcode/runner/cli/rebot.py +++ b/packages/runner/src/robotcode/runner/cli/rebot.py @@ -6,10 +6,10 @@ from robot.errors import DataError, Information from robot.rebot import USAGE, Rebot from robot.version import get_full_version - from robotcode.plugin import Application, pass_application -from robotcode.robot.config.loader import find_project_root, get_config_files_from_folder, load_config_from_path -from robotcode.robot.config.model import RebotProfile, RobotBaseProfile +from robotcode.robot.config.loader import load_config_from_path +from robotcode.robot.config.model import RebotProfile +from robotcode.robot.config.utils import get_config_files from ..__version__ import __version__ @@ -27,7 +27,7 @@ def parse_arguments(self, cli_args: Any) -> Any: line_end = "\n" raise Information( "Dry run, not executing any commands. " - f"Would execute libdoc with the following arguments:\n" + f"Would execute libdoc with the following options and arguments:\n" f'{line_end.join((*(f"{k} = {repr(v)}" for k, v in options.items()) ,*arguments))}' ) @@ -73,28 +73,18 @@ def rebot( except (DataError, Information): pass - root_folder, discovered_by = find_project_root(*(robot_arguments or [])) - app.verbose(lambda: f"Found project root at:\n {root_folder} ({discovered_by.value})") - - profile: Optional[RobotBaseProfile] = None - - if root_folder is not None: - config_files = get_config_files_from_folder(root_folder) - if config_files: - app.verbose(lambda: f"Found configuration files:\n {', '.join(str(f[0]) for f in config_files)}") - try: - profile = load_config_from_path(*config_files).combine_profiles( - *app.config.profiles if app.config.profiles else [], - verbose_callback=app.verbose if app.config.verbose else None, - ) - except (TypeError, ValueError) as e: - raise click.ClickException(str(e)) from e - - else: - app.verbose("No configuration files found.") + config_files, root_folder, _ = get_config_files( + robot_arguments, app.config.config_files, raise_on_error=False, verbose_callback=app.verbose + ) - if profile is None: - profile = RobotBaseProfile() + try: + profile = ( + load_config_from_path(*config_files) + .combine_profiles(*(app.config.profiles or []), verbose_callback=app.verbose) + .evaluated() + ) + except (TypeError, ValueError) as e: + raise click.ClickException(str(e)) from e rebot_options = profile.rebot if rebot_options is None: @@ -102,15 +92,19 @@ def rebot( rebot_options.add_options(profile) - options = rebot_options.build_command_line() + try: + options = rebot_options.build_command_line() + except (TypeError, ValueError) as e: + raise click.ClickException(str(e)) from e if profile.env: for k, v in profile.env.items(): os.environ[k] = v app.verbose(lambda: f"Set environment variable {k} to {v}") + try: app.verbose( - lambda: " Executing robot with the following options:\n " + lambda: "Executing rebot with the following options:\n " + " ".join(f'"{o}"' for o in (options + list(robot_options_and_args))) ) return cast( diff --git a/packages/runner/robotcode/runner/cli/robot.py b/packages/runner/src/robotcode/runner/cli/robot.py similarity index 71% rename from packages/runner/robotcode/runner/cli/robot.py rename to packages/runner/src/robotcode/runner/cli/robot.py index 6324da0b8..5425649ff 100644 --- a/packages/runner/robotcode/runner/cli/robot.py +++ b/packages/runner/src/robotcode/runner/cli/robot.py @@ -6,10 +6,9 @@ from robot.errors import DataError, Information from robot.run import USAGE, RobotFramework from robot.version import get_full_version - from robotcode.plugin import Application, pass_application -from robotcode.robot.config.loader import find_project_root, get_config_files_from_folder, load_config_from_path -from robotcode.robot.config.model import RobotBaseProfile +from robotcode.robot.config.loader import load_config_from_path +from robotcode.robot.config.utils import get_config_files from ..__version__ import __version__ @@ -41,7 +40,7 @@ def parse_arguments(self, cli_args: Any) -> Any: line_end = "\n" raise Information( "Dry run, not executing any commands. " - f"Would execute robot with the following arguments:\n" + f"Would execute robot with the following options and arguments:\n" f'{line_end.join((*(f"{k} = {repr(v)}" for k, v in options.items()) ,*arguments))}' ) @@ -80,34 +79,23 @@ def robot( Use "-- --help" to see the robot help. """ - robot_arguments = None + robot_arguments: Optional[List[Union[str, Path]]] = None try: _, robot_arguments = RobotFramework().parse_arguments(robot_options_and_args) except (DataError, Information): pass - root_folder, discovered_by = find_project_root(*(robot_arguments or [])) - app.verbose(lambda: f"Found project root at:\n {root_folder} ({discovered_by.value})") - - profile: Optional[RobotBaseProfile] = None - - if root_folder is not None: - config_files = get_config_files_from_folder(root_folder) - if config_files: - app.verbose(lambda: f"Found configuration files:\n {', '.join(str(f[0]) for f in config_files)}") - try: - profile = load_config_from_path(*config_files).combine_profiles( - *app.config.profiles if app.config.profiles else [], - verbose_callback=app.verbose if app.config.verbose else None, - ) - except (TypeError, ValueError) as e: - raise click.ClickException(str(e)) from e - - else: - app.verbose("No configuration files found.") - - if profile is None: - profile = RobotBaseProfile() + config_files, root_folder, _ = get_config_files( + robot_arguments, app.config.config_files, raise_on_error=False, verbose_callback=app.verbose + ) + try: + profile = ( + load_config_from_path(*config_files) + .combine_profiles(*(app.config.profiles or []), verbose_callback=app.verbose) + .evaluated() + ) + except (TypeError, ValueError) as e: + raise click.ClickException(str(e)) from e options = profile.build_command_line() @@ -115,9 +103,10 @@ def robot( for k, v in profile.env.items(): os.environ[k] = v app.verbose(lambda: f"Set environment variable {k} to {v}") + try: app.verbose( - lambda: " Executing robot with the following options:\n " + lambda: "Executing robot with the following options:\n " + " ".join(f'"{o}"' for o in (options + list(robot_options_and_args))) ) return cast( diff --git a/packages/runner/src/robotcode/runner/cli/testdoc.py b/packages/runner/src/robotcode/runner/cli/testdoc.py new file mode 100644 index 000000000..e9981c37d --- /dev/null +++ b/packages/runner/src/robotcode/runner/cli/testdoc.py @@ -0,0 +1,111 @@ +import os +from pathlib import Path +from typing import Any, Optional, Tuple, Union, cast + +import click +from robot.errors import DataError, Information +from robot.testdoc import USAGE, TestDoc +from robot.version import get_full_version +from robotcode.plugin import Application, pass_application +from robotcode.robot.config.loader import load_config_from_path +from robotcode.robot.config.model import TestDocProfile +from robotcode.robot.config.utils import get_config_files + +from ..__version__ import __version__ + + +class TestDocEx(TestDoc): + def __init__(self, dry: bool, root_folder: Optional[Path]) -> None: + super().__init__() + self.dry = dry + self.root_folder = root_folder + + def parse_arguments(self, cli_args: Any) -> Any: + options, arguments = super().parse_arguments(cli_args) + + if self.dry: + line_end = "\n" + raise Information( + "Dry run, not executing any commands. " + f"Would execute testdoc with the followingoptions and arguments:\n" + f'{line_end.join((*(f"{k} = {repr(v)}" for k, v in options.items()) ,*arguments))}' + ) + + return options, arguments + + def main(self, arguments: Any, **options: Any) -> Any: + if self.root_folder is not None: + os.chdir(self.root_folder) + + super().main(arguments, **options) + + +@click.command( + context_settings={ + "allow_extra_args": True, + "ignore_unknown_options": True, + }, + add_help_option=True, +) +@click.version_option( + version=__version__, + package_name="robotcode.runner.testdoc", + prog_name="RobotCode TestDoc", + message=f"%(prog)s %(version)s\n{USAGE.splitlines()[0].split(' -- ')[0].strip()} {get_full_version()}", +) +@click.argument("robot_options_and_args", nargs=-1, type=click.Path()) +@pass_application +def testdoc( + app: Application, + robot_options_and_args: Tuple[str, ...], +) -> Union[str, int, None]: + """Runs "testdoc" with the selected configuration, profiles, options and arguments. + + The options and arguments are passed to "testdoc" as is. + + Use "-- --help" to see the testdoc help. + """ + + robot_arguments = None + try: + _, robot_arguments = TestDoc().parse_arguments(robot_options_and_args) + except (DataError, Information): + pass + + config_files, root_folder, _ = get_config_files( + robot_arguments, app.config.config_files, raise_on_error=False, verbose_callback=app.verbose + ) + + try: + profile = ( + load_config_from_path(*config_files) + .combine_profiles(*(app.config.profiles or []), verbose_callback=app.verbose) + .evaluated() + ) + except (TypeError, ValueError) as e: + raise click.ClickException(str(e)) from e + + testdoc_options = profile.testdoc + if testdoc_options is None: + testdoc_options = TestDocProfile() + + testdoc_options.add_options(profile) + + options = testdoc_options.build_command_line() + + if profile.env: + for k, v in profile.env.items(): + os.environ[k] = v + app.verbose(lambda: f"Set environment variable {k} to {v}") + + try: + app.verbose( + lambda: "Executing testdoc with the following options:\n " + + " ".join(f'"{o}"' for o in (options + list(robot_options_and_args))) + ) + return cast( + int, + TestDocEx(app.config.dry, root_folder).execute_cli((*options, *robot_options_and_args), exit=False), + ) + except SystemExit as e: + return cast(int, e.code) diff --git a/packages/runner/robotcode/runner/hooks.py b/packages/runner/src/robotcode/runner/hooks.py similarity index 62% rename from packages/runner/robotcode/runner/hooks.py rename to packages/runner/src/robotcode/runner/hooks.py index 416bdfce9..bf055aa4c 100644 --- a/packages/runner/robotcode/runner/hooks.py +++ b/packages/runner/src/robotcode/runner/hooks.py @@ -1,12 +1,11 @@ from typing import List import click - from robotcode.plugin import hookimpl -from .cli import libdoc, rebot, robot +from .cli import libdoc, rebot, robot, testdoc @hookimpl def hatch_register_cli_commands() -> List[click.Command]: - return [robot, rebot, libdoc] + return [robot, rebot, libdoc, testdoc] diff --git a/packages/runner/robotcode/runner/py.typed b/packages/runner/src/robotcode/runner/py.typed similarity index 100% rename from packages/runner/robotcode/runner/py.typed rename to packages/runner/src/robotcode/runner/py.typed diff --git a/pyproject.toml b/pyproject.toml index 21e9720f0..c6fdf69f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ lint = ["robotframework-robocop>=2.0.0"] tidy = ["robotframework-tidy>=2.0.0"] rest = ["docutils"] colored = ["rich"] -tomlw = ["tomli-w"] +toml = ["tomli-w"] all = [ "robotcode-debugger", "robotcode-language-server", @@ -83,6 +83,7 @@ all = [ "robotcode-analyze", "PyYAML>=5.4", "robotframework-robocop>=2.0.0", + "robotframework-tidy>=2.0.0", "docutils", "rich", "tomli-w", @@ -91,16 +92,16 @@ all = [ [tool.semantic_release] version_variable = [ - "robotcode/cli/__version__.py:__version__", - "packages/core/robotcode/core/__version__.py:__version__", - "packages/debugger/robotcode/debugger/__version__.py:__version__", - "packages/jsonrpc2/robotcode/jsonrpc2/__version__.py:__version__", - "packages/language_server/robotcode/language_server/__version__.py:__version__", - "packages/modifiers/robotcode/modifiers/__version__.py:__version__", - "packages/plugin/robotcode/plugin/__version__.py:__version__", - "packages/runner/robotcode/runner/__version__.py:__version__", - "packages/analyze/robotcode/analyze/__version__.py:__version__", - "packages/robot/robotcode/robot/__version__.py:__version__", + "src/robotcode/cli/__version__.py:__version__", + "packages/core/src/robotcode/core/__version__.py:__version__", + "packages/debugger/src/robotcode/debugger/__version__.py:__version__", + "packages/jsonrpc2/src/robotcode/jsonrpc2/__version__.py:__version__", + "packages/language_server/src/robotcode/language_server/__version__.py:__version__", + "packages/modifiers/src/robotcode/modifiers/__version__.py:__version__", + "packages/plugin/src/robotcode/plugin/__version__.py:__version__", + "packages/runner/src/robotcode/runner/__version__.py:__version__", + "packages/analyze/src/robotcode/analyze/__version__.py:__version__", + "packages/robot/src/robotcode/robot/__version__.py:__version__", ] version_pattern = ['package.json:"version": "{version}"'] branch = "main" @@ -193,13 +194,12 @@ select = [ ] - [tool.ruff.per-file-ignores] #"__init__.py" = ["F401"] [tool.mypy] -python_version = 3.8 +python_version = "3.8" strict = true warn_redundant_casts = true warn_unused_ignores = true @@ -222,17 +222,19 @@ exclude = [ ] mypy_path = [ "typings", - "packages/core", - "packages/debugger", - "packages/jsonrpc2", - "packages/language_server", - "packages/modifiers", - "packages/plugin", - "packages/robot", - "packages/runner", - "packages/analyze", + "src", + "packages/core/src", + "packages/debugger/src", + "packages/jsonrpc2/src", + "packages/language_server/src", + "packages/modifiers/src", + "packages/plugin/src", + "packages/robot/src", + "packages/runner/src", + "packages/analyze/src", ] explicit_package_bases = true +namespace_packages = true [[tool.mypy.overrides]] diff --git a/robotcode/cli/__version__.py b/robotcode/cli/__version__.py deleted file mode 100644 index 0d83d6008..000000000 --- a/robotcode/cli/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.31.0" diff --git a/robotcode/cli/commands/_common.py b/robotcode/cli/commands/_common.py deleted file mode 100644 index 616e5e08c..000000000 --- a/robotcode/cli/commands/_common.py +++ /dev/null @@ -1,60 +0,0 @@ -from pathlib import Path -from typing import Callable, List, Optional, Sequence, Tuple - -import click - -from robotcode.plugin import CommonConfig, OutputFormat -from robotcode.plugin.click_helper import EnumChoice -from robotcode.robot.config.loader import ( - ConfigType, - find_project_root, - get_config_files_from_folder, -) - -format_option = click.option( - "-f", - "--format", - "format", - type=EnumChoice(OutputFormat), - default=OutputFormat.TOML, - help="Set the output format.", - show_default=True, -) - -format_option_flat = click.option( - "-f", - "--format", - "format", - type=EnumChoice(OutputFormat), - default=OutputFormat.FLAT, - help="Set the output format.", - show_default=True, -) - - -def get_config_files( - common_config: CommonConfig, paths: List[Path], verbose_callback: Optional[Callable[[str], None]] -) -> Sequence[Tuple[Path, ConfigType]]: - if common_config.config_file is not None: - if verbose_callback: - verbose_callback(f"Using config file: {common_config.config_file}") - - return [(common_config.config_file, ConfigType.CUSTOM_TOML)] - - root_folder, discovered_by = find_project_root(*(paths or [])) - - if root_folder is None: - raise click.ClickException("Cannot detect root folder for project. 😥") - - if verbose_callback: - verbose_callback(f"Found project root at:\n {root_folder} ({discovered_by.value})") - - result = get_config_files_from_folder(root_folder) - - if result: - if verbose_callback: - verbose_callback( - "Found configuration files:\n " + "\n ".join(str(f[0]) for f in result), - ) - - return result diff --git a/scripts/create_robot_toml_json_schema.py b/scripts/create_robot_toml_json_schema.py index 39fa243f5..766720e56 100644 --- a/scripts/create_robot_toml_json_schema.py +++ b/scripts/create_robot_toml_json_schema.py @@ -5,7 +5,6 @@ from typing import Any, Callable, Optional import apischema - from robotcode.robot.config.model import RobotConfig if __name__ == "__main__": diff --git a/scripts/generate_rf_options.py b/scripts/generate_rf_options.py index 0ff620fd6..d5bc67d5f 100644 --- a/scripts/generate_rf_options.py +++ b/scripts/generate_rf_options.py @@ -6,7 +6,7 @@ from robot.libdoc import USAGE as LIBDOC_USAGE from robot.rebot import USAGE as REBOT_USAGE from robot.run import USAGE as ROBOT_USAGE - +from robot.testdoc import USAGE as TESTDOC_USAGE from robotcode.core.dataclasses import to_snake_case EXAMPLES_RE = re.compile(r"(?P^\s*)Examples:\s*(?P.*)", re.MULTILINE) @@ -18,11 +18,13 @@ type_templates = { "console": 'Literal["verbose", "dotted", "skipped", "quiet", "none"]', - "listeners": "Dict[str, List[str]]", - "parser": "Dict[str, List[str]]", - "pre_rebot_modifiers": "Dict[str, List[str]]", - "pre_run_modifiers": "Dict[str, List[str]]", - "randomize": 'Optional[Union[str, Literal["all", "suites", "tests", "none"]]]', + "listeners": "Dict[str, List[Union[str, StringExpression]]]", + "parser": "Dict[str, List[Union[str, StringExpression]]]", + "pre_rebot_modifiers": "Dict[str, List[Union[str, StringExpression]]]", + "pre_run_modifiers": "Dict[str, List[Union[str, StringExpression]]]", + "randomize": 'Union[str, Literal["all", "suites", "tests", "none"]]', + "tag_stat_combine": "List[Union[str, Dict[str, str]]]", + "flatten_keywords": 'Optional[List[Union[str, Literal["for", "while", "iteration"], NamePattern, TagPattern]]]', } name_corrections = { @@ -64,7 +66,7 @@ def generate( in_examples = False for line in usage_splitted: - if line.startswith((" -", " --")): + if line.startswith((" -", " -", " --")): if current_line is not None: if in_examples: in_examples = False @@ -140,14 +142,27 @@ def get_type(name: str, value: Any, option: Dict[str, str], is_flag: bool = Fals base_type = "str" if value is None or isinstance(value, (tuple, list)) else type(value).__name__ + if base_type == "str": + base_type = "Union[str, StringExpression]" + if param := option.get("param", None): if len((param_splitted := param.split("|"))) > 1: - needs_str = "Union[str, " if any(True for x in param_splitted if ":" in x) else "" + has_literal = [x for x in param_splitted if ":" not in x] + has_pattern = [x for x in param_splitted if ":" in x] base_type = ( - f"{needs_str}Literal[" - + ", ".join([f'"{x}"' for x in param_splitted]) - + "]" - + ("]" if needs_str else "") + ("Union[" if has_literal and has_pattern or len(has_pattern) > 1 else "") + + (("Literal[" + ", ".join([f'"{x}"' for x in has_literal]) + "]") if has_literal else "") + + ( + ( + (", " if has_literal else "") + + ", ".join( + (x.split(":")[0].capitalize() + x.split(":")[1][1:-1].capitalize()) for x in has_pattern + ) + ) + if has_pattern + else "" + ) + + ("]" if has_literal and has_pattern or len(has_pattern) > 1 else "") ) elif len((param_splitted := param.split(":"))) > 1: @@ -158,7 +173,6 @@ def get_type(name: str, value: Any, option: Dict[str, str], is_flag: bool = Fals return f"Optional[{base_type}]" - # cmd_options.pop("--rpa") def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = False) -> Dict[str, Any]: result = {} @@ -180,7 +194,7 @@ def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = Fa output.append( f" {name}" f': {get_type(name, internal_options[long_name]["default"], v, is_flag, extra)} = field(\n' - f' description="""\\\n{create_desc(v, extra)}\n """,\n' + f' description="""\\\n{create_desc(v, extra)}\n """,' ) if not extra: output.append(f' robot_name="{long_name}",') @@ -192,8 +206,6 @@ def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = Fa if not flag_default: output.append(f" robot_flag_default={flag_default},") output.append(" )") - else: - output.append(f" # {long_name}") return result @@ -253,6 +265,7 @@ def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = Fa "PythonPath": ("pythonpath", []), "Quiet": ("quiet", False), } + output.append("") output.append("") output.append("@dataclass") @@ -271,7 +284,7 @@ def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = Fa output.append("") output.append("@dataclass") output.append("class LibDocExtraOptions(BaseOptions):") -output.append(' """Options for _libdoc_ command."""') +output.append(' """Extra options for _libdoc_ command."""') output.append("") generate( output, @@ -281,6 +294,41 @@ def build_class_fields(output: List[str], opts: Dict[str, Any], extra: bool = Fa extra=True, ) + +testdoc_options: Dict[str, Tuple[str, Any]] = { + "Title": ("title", None), + "Name": ("name", None), + "Format": ("format", None), + **RobotSettings._cli_opts, +} +output.append("") +output.append("") +output.append("@dataclass") +output.append("class TestDocOptions(BaseOptions):") +output.append(' """Options for _testdoc_ command."""') +output.append("") +extra_cmd_options = generate( + output, + TESTDOC_USAGE, + testdoc_options, + None, + extra=False, +) + +output.append("") +output.append("") +output.append("@dataclass") +output.append("class TestDocExtraOptions(BaseOptions):") +output.append(' """Extra options for _testdoc_ command."""') +output.append("") +generate( + output, + TESTDOC_USAGE, + testdoc_options, + extra_cmd_options, + extra=True, +) + model_file = Path("packages/robot/robotcode/robot/config/model.py") original_lines = model_file.read_text().splitlines() diff --git a/robotcode/cli/__init__.py b/src/robotcode/cli/__init__.py similarity index 91% rename from robotcode/cli/__init__.py rename to src/robotcode/cli/__init__.py index 818892bfb..c9c318d00 100644 --- a/robotcode/cli/__init__.py +++ b/src/robotcode/cli/__init__.py @@ -2,7 +2,6 @@ from typing import List, Optional import click - from robotcode.plugin import Application, ColoredOutput, pass_application from robotcode.plugin.manager import PluginManager @@ -18,10 +17,14 @@ @click.option( "-c", "--config", - "config_file", + "config_files", type=click.Path(exists=True, path_type=Path), + multiple=True, show_envvar=True, - help="Config file to use.", + help="""\ + Config file to use. Can be specified multiple times. + If not specified, the default config file is used. + """, ) @click.option( "-p", @@ -49,7 +52,7 @@ def robotcode( app: Application, ctx: click.Context, - config_file: Optional[Path], + config_files: Optional[List[Path]], profiles: Optional[List[str]], dry: bool, verbose: bool, @@ -65,7 +68,7 @@ def robotcode( A CLI tool for Robot Framework. """ - app.config.config_file = config_file + app.config.config_files = config_files app.config.profiles = profiles app.config.dry = dry app.config.verbose = verbose diff --git a/robotcode/cli/__main__.py b/src/robotcode/cli/__main__.py similarity index 100% rename from robotcode/cli/__main__.py rename to src/robotcode/cli/__main__.py diff --git a/src/robotcode/cli/__version__.py b/src/robotcode/cli/__version__.py new file mode 100644 index 000000000..13844a7b3 --- /dev/null +++ b/src/robotcode/cli/__version__.py @@ -0,0 +1 @@ +__version__ = "0.32.0" diff --git a/robotcode/cli/commands/__init__.py b/src/robotcode/cli/commands/__init__.py similarity index 100% rename from robotcode/cli/commands/__init__.py rename to src/robotcode/cli/commands/__init__.py diff --git a/src/robotcode/cli/commands/_common.py b/src/robotcode/cli/commands/_common.py new file mode 100644 index 000000000..dcc56948a --- /dev/null +++ b/src/robotcode/cli/commands/_common.py @@ -0,0 +1,23 @@ +import click +from robotcode.plugin import OutputFormat +from robotcode.plugin.click_helper import EnumChoice + +format_option = click.option( + "-f", + "--format", + "format", + type=EnumChoice(OutputFormat), + default=OutputFormat.TOML, + help="Set the output format.", + show_default=True, +) + +format_option_flat = click.option( + "-f", + "--format", + "format", + type=EnumChoice(OutputFormat), + default=OutputFormat.FLAT, + help="Set the output format.", + show_default=True, +) diff --git a/robotcode/cli/commands/config.py b/src/robotcode/cli/commands/config.py similarity index 86% rename from robotcode/cli/commands/config.py rename to src/robotcode/cli/commands/config.py index d1127cf79..dde601643 100644 --- a/robotcode/cli/commands/config.py +++ b/src/robotcode/cli/commands/config.py @@ -2,7 +2,6 @@ from typing import List, Union import click - from robotcode.core.dataclasses import as_dict from robotcode.plugin import Application, OutputFormat, pass_application from robotcode.plugin.click_helper import add_options @@ -10,8 +9,9 @@ find_project_root, load_config_from_path, ) +from robotcode.robot.config.utils import get_config_files -from ._common import format_option, get_config_files +from ._common import format_option @click.group( @@ -44,9 +44,7 @@ def show( ) -> Union[str, int, None]: """Shows Robot Framework configuration.""" - config_files = get_config_files(app.config, paths, app.verbose) - if not config_files: - raise click.ClickException("Cannot find any configuration file. 😥") + config_files, _, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose) try: if single: @@ -76,14 +74,16 @@ def files( ) -> Union[str, int, None]: """Shows Robot Framework configuration files.""" - config_files = get_config_files(app.config, paths, app.verbose) + try: + config_files, _, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose) - if config_files: for config_file, _ in config_files: click.echo(config_file) + return 0 - raise click.ClickException("No configuration found. 😥") + except FileNotFoundError as e: + raise click.ClickException(str(e)) from e @config.command diff --git a/robotcode/cli/commands/profiles.py b/src/robotcode/cli/commands/profiles.py similarity index 54% rename from robotcode/cli/commands/profiles.py rename to src/robotcode/cli/commands/profiles.py index e8c8ef581..08e8c0218 100644 --- a/robotcode/cli/commands/profiles.py +++ b/src/robotcode/cli/commands/profiles.py @@ -2,15 +2,15 @@ from typing import List, Union import click - from robotcode.core.dataclasses import as_dict from robotcode.plugin import Application, OutputFormat, pass_application from robotcode.plugin.click_helper import add_options from robotcode.robot.config.loader import ( load_config_from_path, ) +from robotcode.robot.config.utils import get_config_files -from ._common import format_option, format_option_flat, get_config_files +from ._common import format_option, format_option_flat @click.group( @@ -25,27 +25,31 @@ def profiles(app: Application) -> Union[str, int, None]: @profiles.command @add_options(format_option) +@click.option( + "-n", "--no-evaluate", "no_evaluate", is_flag=True, default=False, help="Don't evaluate expressions in the profile." +) @click.argument("paths", type=click.Path(exists=True, path_type=Path), nargs=-1, required=False) @pass_application def show( app: Application, format: OutputFormat, + no_evaluate: bool, paths: List[Path], ) -> Union[str, int, None]: """Shows the given Robot Framework profile.""" - - config_files = get_config_files(app.config, paths, app.verbose) - if not config_files: - raise click.ClickException("Cannot find any configuration file. 😥") - try: - profile = load_config_from_path(*config_files).combine_profiles( + config_files, _, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose) + + config = load_config_from_path(*config_files).combine_profiles( *(app.config.profiles or []), verbose_callback=app.verbose ) - app.print_dict(as_dict(profile, remove_defaults=True), format) + if not no_evaluate: + config = config.evaluated() + + app.print_dict(as_dict(config, remove_defaults=True), format) - except (TypeError, ValueError) as e: + except (TypeError, ValueError, FileNotFoundError) as e: raise click.ClickException(str(e)) from e return 0 @@ -62,22 +66,30 @@ def list( ) -> Union[str, int, None]: """List the defined profiles in the given Robot Framework configuration.""" - config_files = get_config_files(app.config, paths, app.verbose) - if not config_files: - raise click.ClickException("Cannot find any configuration file. 😥") - try: + config_files, _, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose) + config = load_config_from_path(*config_files) + selected_profiles = [ + k for k in config.select_profiles(*(app.config.profiles or []), verbose_callback=app.verbose).keys() + ] - result = {"profiles": {k: {"description": v.description or ""} for k, v in (config.profiles or {}).items()}} + result = { + "profiles": { + k: {"description": v.description or "", "selected": True if k in selected_profiles else False} + for k, v in (config.profiles or {}).items() + } + } if format == OutputFormat.FLAT: for profile, v in result["profiles"].items(): - click.secho(profile + " - " + v["description"]) + click.secho( + f'{"* " if v["selected"] else " "}{profile} {v["description"] if v["description"] else ""}' + ) else: app.print_dict(result, format) - except (TypeError, ValueError) as e: + except (TypeError, ValueError, FileNotFoundError) as e: raise click.ClickException(str(e)) from e return 0 diff --git a/robotcode/cli/py.typed b/src/robotcode/cli/py.typed similarity index 100% rename from robotcode/cli/py.typed rename to src/robotcode/cli/py.typed diff --git a/tests/robotcode/core/test_safeeval.py b/tests/robotcode/core/test_safeeval.py index 03f3764fa..1fe873dc3 100644 --- a/tests/robotcode/core/test_safeeval.py +++ b/tests/robotcode/core/test_safeeval.py @@ -3,7 +3,6 @@ from typing import Any import pytest - from robotcode.core.utils.safe_eval import safe_eval diff --git a/tests/robotcode/jsonrpc/test_jsonrpcprotocol.py b/tests/robotcode/jsonrpc/test_jsonrpcprotocol.py index f8e1ecf97..a189fb772 100644 --- a/tests/robotcode/jsonrpc/test_jsonrpcprotocol.py +++ b/tests/robotcode/jsonrpc/test_jsonrpcprotocol.py @@ -2,7 +2,6 @@ from typing import Any, Dict, Iterator, List, Optional, cast import pytest - from robotcode.core.dataclasses import as_dict, as_json from robotcode.jsonrpc2.protocol import ( JsonRPCError, diff --git a/tests/robotcode/language_server/common/test_text_document.py b/tests/robotcode/language_server/common/test_text_document.py index 4e65faf37..bb8d1eacd 100644 --- a/tests/robotcode/language_server/common/test_text_document.py +++ b/tests/robotcode/language_server/common/test_text_document.py @@ -1,5 +1,4 @@ import pytest - from robotcode.core.async_tools import check_canceled from robotcode.language_server.common.lsp_types import Position, Range from robotcode.language_server.common.text_document import ( diff --git a/tests/robotcode/language_server/robotframework/parts/conftest.py b/tests/robotcode/language_server/robotframework/parts/conftest.py index 876e399a3..8bcde938c 100644 --- a/tests/robotcode/language_server/robotframework/parts/conftest.py +++ b/tests/robotcode/language_server/robotframework/parts/conftest.py @@ -5,7 +5,6 @@ import pytest import pytest_asyncio - from robotcode.core.dataclasses import as_dict from robotcode.language_server.common.lsp_types import ( ClientCapabilities, @@ -25,6 +24,7 @@ RobotLanguageServerProtocol, ) from robotcode.language_server.robotframework.server import RobotLanguageServer + from tests.robotcode.language_server.robotframework.tools import generate_test_id from .pytest_regtestex import RegTestFixtureEx diff --git a/tests/robotcode/language_server/robotframework/parts/data/.vscode/settings.json b/tests/robotcode/language_server/robotframework/parts/data/.vscode/settings.json index b78e8a9c1..e0846234f 100644 --- a/tests/robotcode/language_server/robotframework/parts/data/.vscode/settings.json +++ b/tests/robotcode/language_server/robotframework/parts/data/.vscode/settings.json @@ -24,7 +24,7 @@ // // "--log-language-server" // "--call-tracing" ], - "robotcode.robocop.enabled": true, + "robotcode.robocop.enabled": false, // "robotcode.debug.groupOutput": false, // "robotcode.robot.args": [ // "-L", "TRACE" diff --git a/tests/robotcode/language_server/robotframework/parts/data/robot.toml b/tests/robotcode/language_server/robotframework/parts/data/robot.toml index b91306a6a..7104ef0e3 100644 --- a/tests/robotcode/language_server/robotframework/parts/data/robot.toml +++ b/tests/robotcode/language_server/robotframework/parts/data/robot.toml @@ -2,8 +2,14 @@ paths = "tests" args = [] python-path = ["./lib", "./resources"] -output-dir = "results" +output-dir = { expr = "f'results/run-{datetime.now().strftime(\"%d-%m-%Y-%H.%M.%S\")}'" } rpa = true +flatten-keywords = [ + { name = "My Keyword" }, + { tag = "my-tag" }, + "name:My Keyword", +] +expand-keywords = [{ name = "My Keyword" }, { tag = "my-tag" }] [rebot] merge = "on" @@ -15,9 +21,9 @@ format = "HTML" ENV_VAR = "1" [variables] -CMD_VAR = "1" +CMD_VAR = { expr = "1+2*5" } CMD_VAR_LONG = "a test" - +ANOTHER_VAR = { expr = "environ.get('CMD_VAR_LONG', 'default')" } [profiles.firefox.rebot] merge = "on" @@ -38,7 +44,7 @@ MyListener = ["firefox", "c:\\test\\blah"] HEADLESS = "true" [profiles.ci-browser] -enabled = { if = 'env.get("CI") == "true"' } +enabled = { if = 'environ.get("CI") == "true"' } extra-variables = { BROWSER = "chromium" } [tool.robotcode-analyzer] diff --git a/tests/robotcode/language_server/robotframework/parts/pytest_regtestex.py b/tests/robotcode/language_server/robotframework/parts/pytest_regtestex.py index 9b21ccf8a..72c8992bb 100644 --- a/tests/robotcode/language_server/robotframework/parts/pytest_regtestex.py +++ b/tests/robotcode/language_server/robotframework/parts/pytest_regtestex.py @@ -1,7 +1,6 @@ import os from pytest_regtest import RegTestFixture - from robotcode.language_server.robotframework.utils.version import get_robot_version rf_version = f"rf{get_robot_version()[0]}{get_robot_version()[1]}" diff --git a/tests/robotcode/language_server/robotframework/parts/test_code_action_show_documentation.py b/tests/robotcode/language_server/robotframework/parts/test_code_action_show_documentation.py index b75c0669e..4601ff460 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_code_action_show_documentation.py +++ b/tests/robotcode/language_server/robotframework/parts/test_code_action_show_documentation.py @@ -5,7 +5,6 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import ( CodeAction, CodeActionContext, @@ -19,6 +18,7 @@ from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_discovering.py b/tests/robotcode/language_server/robotframework/parts/test_discovering.py index 45d9862e9..29959cfe2 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_discovering.py +++ b/tests/robotcode/language_server/robotframework/parts/test_discovering.py @@ -4,7 +4,6 @@ import pytest import yaml - from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) diff --git a/tests/robotcode/language_server/robotframework/parts/test_document_highlight.py b/tests/robotcode/language_server/robotframework/parts/test_document_highlight.py index c606622bd..dd954131a 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_document_highlight.py +++ b/tests/robotcode/language_server/robotframework/parts/test_document_highlight.py @@ -4,12 +4,12 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import Position from robotcode.language_server.common.text_document import TextDocument from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_foldingrange.py b/tests/robotcode/language_server/robotframework/parts/test_foldingrange.py index 669042a95..c7254826e 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_foldingrange.py +++ b/tests/robotcode/language_server/robotframework/parts/test_foldingrange.py @@ -5,7 +5,6 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import ( ClientCapabilities, FoldingRangeClientCapabilities, @@ -15,6 +14,7 @@ from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_goto_definition.py b/tests/robotcode/language_server/robotframework/parts/test_goto_definition.py index 239d6a28d..089afcde1 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_goto_definition.py +++ b/tests/robotcode/language_server/robotframework/parts/test_goto_definition.py @@ -4,12 +4,12 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import Position from robotcode.language_server.common.text_document import TextDocument from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_goto_implementation.py b/tests/robotcode/language_server/robotframework/parts/test_goto_implementation.py index 3199e9f7a..4a7814872 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_goto_implementation.py +++ b/tests/robotcode/language_server/robotframework/parts/test_goto_implementation.py @@ -5,13 +5,13 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.core.uri import Uri from robotcode.language_server.common.lsp_types import Location, LocationLink, Position from robotcode.language_server.common.text_document import TextDocument from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_hover.py b/tests/robotcode/language_server/robotframework/parts/test_hover.py index 97946e9d1..eddd93096 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_hover.py +++ b/tests/robotcode/language_server/robotframework/parts/test_hover.py @@ -5,12 +5,12 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import Hover, MarkupContent, Position from robotcode.language_server.common.text_document import TextDocument from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/parts/test_references.py b/tests/robotcode/language_server/robotframework/parts/test_references.py index 6a7921dd1..e6f31a34c 100644 --- a/tests/robotcode/language_server/robotframework/parts/test_references.py +++ b/tests/robotcode/language_server/robotframework/parts/test_references.py @@ -4,7 +4,6 @@ import pytest import yaml from pytest_regtest import RegTestFixture - from robotcode.language_server.common.lsp_types import ( Location, Position, @@ -14,6 +13,7 @@ from robotcode.language_server.robotframework.protocol import ( RobotLanguageServerProtocol, ) + from tests.robotcode.language_server.robotframework.tools import ( GeneratedTestData, generate_test_id, diff --git a/tests/robotcode/language_server/robotframework/tools.py b/tests/robotcode/language_server/robotframework/tools.py index 31d620039..322d289f3 100644 --- a/tests/robotcode/language_server/robotframework/tools.py +++ b/tests/robotcode/language_server/robotframework/tools.py @@ -6,7 +6,6 @@ import pytest import yaml - from robotcode.core.dataclasses import CamelSnakeMixin, as_dict TEST_EXPRESSION_LINE = re.compile(r"^\#\s*(?PTODO)?\s*(?P\^+)\s+(?P.*)") diff --git a/tests/robotcode/robot/config/test_loader.py b/tests/robotcode/robot/config/test_loader.py index 56e339c19..16e09a0be 100644 --- a/tests/robotcode/robot/config/test_loader.py +++ b/tests/robotcode/robot/config/test_loader.py @@ -3,7 +3,6 @@ from typing import Iterator, Tuple import pytest - from robotcode.robot.config.loader import DiscoverdBy, find_project_root, get_config_files_from_folder diff --git a/tests/robotcode/robot/config/test_model.py b/tests/robotcode/robot/config/test_model.py index 50a2659a3..1f518f0a1 100644 --- a/tests/robotcode/robot/config/test_model.py +++ b/tests/robotcode/robot/config/test_model.py @@ -1,7 +1,6 @@ from typing import Any, Dict import pytest - from robotcode.core.dataclasses import TypeValidationError, as_dict, from_dict from robotcode.robot.config.model import RobotConfig diff --git a/tests/robotcode/robot/config/test_profile.py b/tests/robotcode/robot/config/test_profile.py index c8fbd3e71..3f44c4562 100644 --- a/tests/robotcode/robot/config/test_profile.py +++ b/tests/robotcode/robot/config/test_profile.py @@ -1,7 +1,6 @@ import os import pytest - from robotcode.robot.config.loader import loads_config_from_robot_toml @@ -193,12 +192,12 @@ def test_profiles_enabled_can_be_an_condition() -> None: extra-args = ["devel"] [profiles.another-ci] - enabled={if='env.get("ANOTHER-CI") == "true"'} + enabled={if='environ.get("ANOTHER-CI") == "true"'} description = "Another CI profile" extra-args = ["another-ci"] [profiles.ci] - enabled={if='env.get("CI") == "true"'} + enabled={if='environ.get("CI") == "true"'} description = "CI profile" extra-args = ["ci"] """ @@ -227,17 +226,73 @@ def test_profiles_enabled_cant_be_an_invalid_condition() -> None: extra-args = ["devel"] [profiles.another-ci] - enabled={if='env.get("ANOTHER-CI") == "true"'} + enabled={if='environ.get("ANOTHER-CI") == "true"'} description = "Another CI profile" extra-args = ["another-ci"] [profiles.ci] - enabled={if='env.get("CI") = "true"'} + enabled={if='environ.get("CI") = "true"'} description = "CI profile" extra-args = ["ci"] """ config = loads_config_from_robot_toml(data) os.environ["CI"] = "true" + with pytest.raises(ValueError, match=".*invalid syntax.*"): + config.combine_profiles("*") + + +def test_profiles_precedence_defines_the_order() -> None: + data = """\ + args = ["orig"] + + [profiles.default] + extra-args = ["default"] + precedence = 4 + + [profiles.devel] + extra-args = ["devel"] + precedence = 3 + + [profiles.another-ci] + extra-args = ["another-ci"] + precedence = 2 + + [profiles.ci] + extra-args = ["ci"] + precedence = 1 + """ + config = loads_config_from_robot_toml(data) profile = config.combine_profiles("*") - assert profile - assert profile.args == ["orig", "default"] + assert profile.args == ["orig", "ci", "another-ci", "devel", "default"] + + +def test_profiles_tag_stat_combine_generates_correct() -> None: + data = """\ + tag-stat-combine = ["tag1:tag2", {"tag3" = "tag4"}] + extra-tag-stat-combine = ["tag1:tag2", {"tag3" = "tag4"}] + """ + config = loads_config_from_robot_toml(data) + cmd_line = config.combine_profiles().evaluated().build_command_line() + assert cmd_line == ["--tagstatcombine", "tag1:tag2", "--tagstatcombine", "tag3:tag4"] + + +def test_profiles_flatten_keywords_supports_literals_and_patterns() -> None: + data = """\ + flatten_keywords = ["for", "while", "iteration", {"name" = "tag4"}, {tag="tag5"}, "foritem"] + """ + config = loads_config_from_robot_toml(data) + cmd_line = config.combine_profiles().evaluated().build_command_line() + assert cmd_line == [ + "--flattenkeywords", + "for", + "--flattenkeywords", + "while", + "--flattenkeywords", + "iteration", + "--flattenkeywords", + "name:tag4", + "--flattenkeywords", + "tag:tag5", + "--flattenkeywords", + "foritem", + ]