Skip to content

Commit 078be2a

Browse files
committed
test: Enable to filter pytest tests to run
Previously, when using the python scripts generating buildkite steps, we were only able to run the entire tests. However, in some cases, we would like to run only a subset of them. Adds a new argument `-k` (or `--keywords`) to filter pytest tests to run. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent b195cd1 commit 078be2a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.buildkite/common.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ def __call__(self, parser, namespace, value, option_string=None):
184184
default=[],
185185
type=str,
186186
)
187+
COMMON_PARSER.add_argument(
188+
"-k",
189+
"--keywords",
190+
help="Keywords to filter pytest tests to run",
191+
required=False,
192+
default=None,
193+
type=str,
194+
)
187195

188196

189197
def random_str(k: int):
@@ -360,6 +368,8 @@ def devtool_test(self, devtool_opts=None, pytest_opts=None):
360368
parts.append("--")
361369
if self.binary_dir is not None:
362370
parts.append(f"--binary-dir=../{self.binary_dir}/$(uname -m)")
371+
if self.args.keywords is not None:
372+
parts.append(f"-k {self.args.keywords}")
363373
if pytest_opts:
364374
parts.append(pytest_opts)
365375
cmds.append(" ".join(parts))

0 commit comments

Comments
 (0)