Skip to content

Commit dd3871f

Browse files
authored
Merge pull request #10 from larsks/fix/require-command
Require command argument for br.py
2 parents d77676d + 97932b7 commit dd3871f

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
@@ -155,6 +155,9 @@ def run(args: argparse.Namespace):
155155
"none": "dummy-localqueue",
156156
}
157157

158+
if not args.command:
159+
sys.exit("ERROR: you must provide a command")
160+
158161
if args.gpu not in DEFAULT_QUEUES:
159162
sys.exit(f"ERROR: unsupported GPU {args.gpu} : no queue found")
160163
queue_name = DEFAULT_QUEUES[args.gpu]

tests/test_br.py

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

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

@@ -41,6 +42,7 @@ def test_create_job_nowait(
4142
args = parser.parse_args(["br"])
4243
args.wait = False
4344
args.job_id = 123
45+
args.command = ["true"]
4446

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

0 commit comments

Comments
 (0)