Skip to content

Commit be7cb54

Browse files
committed
Require command argument for br.py
If no command is provided, we end up with a syntactically invalid shell script.
1 parent 86b6d8c commit be7cb54

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

br.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ def run(args: argparse.Namespace):
186186
"none": "dummy-localqueue",
187187
}
188188

189+
if not args.command:
190+
sys.exit("ERROR: you must provide a command")
191+
189192
if args.gpu not in DEFAULT_QUEUES:
190193
sys.exit(f"ERROR: unsupported GPU {args.gpu} : no queue found")
191194
queue_name = DEFAULT_QUEUES[args.gpu]

tests/test_br.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def tempdir():
1616

1717
def test_invalid_gpu(args: argparse.Namespace):
1818
args.gpu = "invalid"
19+
args.command = ["true"]
1920
with pytest.raises(SystemExit) as err:
2021
CreateJobCommand.run(args)
2122

@@ -40,6 +41,7 @@ def test_create_job_nowait(
4041
args = parser.parse_args(["br"])
4142
args.wait = False
4243
args.job_id = 123
44+
args.command = ["true"]
4345

4446
mock_getcwd.return_value = tempdir
4547
mock_gethostname.return_value = "testhost"

0 commit comments

Comments
 (0)