File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -300,7 +300,12 @@ def make_r2d(argv=None):
300300 r2d .user_name = args .user_name
301301
302302 if args .build_memory_limit :
303- r2d .build_memory_limit = args .build_memory_limit
303+ # if the string only contains numerals we assume it should be an int
304+ # and specifies a size in bytes
305+ if args .build_memory_limit .isnumeric ():
306+ r2d .build_memory_limit = int (args .build_memory_limit )
307+ else :
308+ r2d .build_memory_limit = args .build_memory_limit
304309
305310 if args .environment and not r2d .run :
306311 print ('To specify environment variables, you also need to run '
Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ def test_dry_run():
4040 assert not r2d .run
4141 assert not r2d .push
4242
43+
44+ def test_mem_limit ():
45+ """
46+ Test various ways of passing --build-memory-limit
47+ """
48+ r2d = make_r2d (['--build-memory-limit' , '1024' , '.' ])
49+ assert int (r2d .build_memory_limit ) == 1024
50+
51+ r2d = make_r2d (['--build-memory-limit' , '3K' , '.' ])
52+ assert int (r2d .build_memory_limit ) == 1024 * 3
53+
4354def test_run_required ():
4455 """
4556 Test all the things that should fail if we pass in --no-run
You can’t perform that action at this time.
0 commit comments