Skip to content

Commit d2cb7dc

Browse files
committed
feature(runner): implement command line options to select tests/tasks/suites by longname
1 parent 1126605 commit d2cb7dc

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

.vscode/launch.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"args": [
5454
"--verbose",
55-
"--dry",
55+
// "--dry",
5656
// "-p",
5757
// "firefox",
5858
// "--dry",
@@ -65,10 +65,14 @@
6565
// "list",
6666
// "--format",
6767
// "toml"
68-
"config",
69-
"info",
70-
"desc",
71-
"*"
68+
"robot",
69+
"-t", "first",
70+
"-ZLN", "Data.Tests.Playground.first",
71+
"--name", "blahblah",
72+
"-ZLN", "Data.Tests.Playground.second",
73+
"--doc", "uchda",
74+
"-ZEL", "Data.Tests.Playground.third",
75+
"."
7276
]
7377
},
7478
{

packages/runner/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies = [
2929
"robotframework>=4.1.0",
3030
"robotcode-plugin",
3131
"robotcode-robot",
32+
"robotcode-modifiers",
3233
"robotcode",
3334
]
3435
dynamic = ["version"]

packages/runner/src/robotcode/runner/cli/robot.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,23 @@ def main(self, arguments: Any, **options: Any) -> Any:
6666
prog_name="RobotCode Runner",
6767
message=f"%(prog)s %(version)s\n{USAGE.splitlines()[0].split(' -- ')[0].strip()} {get_full_version()}",
6868
)
69+
@click.option(
70+
"longname", "-ZLN", "--by-longname", type=str, multiple=True, help="Select tests/tasks or suites by longname."
71+
)
72+
@click.option(
73+
"exclude_longname",
74+
"-ZEL",
75+
"--exclude-by-longname",
76+
type=str,
77+
multiple=True,
78+
help="Excludes tests/tasks or suites by longname.",
79+
)
6980
@click.argument("robot_options_and_args", nargs=-1, type=click.Path())
7081
@pass_application
7182
def robot(
7283
app: Application,
84+
longname: Tuple[str, ...],
85+
exclude_longname: Tuple[str, ...],
7386
robot_options_and_args: Tuple[str, ...],
7487
) -> Union[str, int, None]:
7588
"""Runs "robot" with the selected configuration, profiles, options and arguments.
@@ -99,6 +112,14 @@ def robot(
99112

100113
options = profile.build_command_line()
101114

115+
if longname:
116+
sep = ";" if any(True for l in longname if ":" in l) else ":"
117+
options += ("--prerunmodifier", f"robotcode.modifiers.ByLongName:{sep.join(longname)}")
118+
119+
if exclude_longname:
120+
sep = ";" if any(True for l in exclude_longname if ":" in l) else ":"
121+
options += ("--prerunmodifier", f"robotcode.modifiers.ExcludedByLongName:{sep.join(exclude_longname)}")
122+
102123
if profile.env:
103124
for k, v in profile.env.items():
104125
os.environ[k] = v

0 commit comments

Comments
 (0)