Skip to content

Commit

Permalink
Fix test and make nargs configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Sep 8, 2023
1 parent 2525823 commit a670f02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 4 additions & 2 deletions runtimepy/commands/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
from argparse import ArgumentParser as _ArgumentParser


def arbiter_args(parser: _ArgumentParser) -> None:
def arbiter_args(parser: _ArgumentParser, nargs: str = "+") -> None:
"""Add common connection-arbiter parameters.."""

parser.add_argument(
"--init_only",
action="store_true",
help="exit after completing initialization",
)
parser.add_argument("configs", nargs="+", help="the configuration to load")
parser.add_argument(
"configs", nargs=nargs, help="the configuration to load"
)
17 changes: 6 additions & 11 deletions tests/commands/test_arbiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@
def test_arbiter_command_basic():
"""Test basic usages of the 'arbiter' command."""

for entry in ["basic.yaml"]:
assert (
runtimepy_main(
[
PKG_NAME,
"arbiter",
"--init_only",
str(resource("connection_arbiter", entry)),
]
)
== 0
assert (
runtimepy_main(
[PKG_NAME, "arbiter", "--init_only", str(resource("empty.yaml"))]
)
== 0
)

for entry in ["basic.yaml"]:
assert (
runtimepy_main(
[
Expand Down
1 change: 1 addition & 0 deletions tests/data/valid/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---

0 comments on commit a670f02

Please sign in to comment.