Merge pull request #652 from betatim/fix-memory-limit

[MRG] Fix handling of memory limit command line argument
pull/663/head
Tim Head 2019-04-30 21:34:52 +02:00 zatwierdzone przez GitHub
commit 92d69010c7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 17 dodań i 1 usunięć

Wyświetl plik

@ -300,7 +300,12 @@ def make_r2d(argv=None):
r2d.user_name = args.user_name
if args.build_memory_limit:
r2d.build_memory_limit = args.build_memory_limit
# if the string only contains numerals we assume it should be an int
# and specifies a size in bytes
if args.build_memory_limit.isnumeric():
r2d.build_memory_limit = int(args.build_memory_limit)
else:
r2d.build_memory_limit = args.build_memory_limit
if args.environment and not r2d.run:
print('To specify environment variables, you also need to run '

Wyświetl plik

@ -40,6 +40,17 @@ def test_dry_run():
assert not r2d.run
assert not r2d.push
def test_mem_limit():
"""
Test various ways of passing --build-memory-limit
"""
r2d = make_r2d(['--build-memory-limit', '1024', '.'])
assert int(r2d.build_memory_limit) == 1024
r2d = make_r2d(['--build-memory-limit', '3K', '.'])
assert int(r2d.build_memory_limit) == 1024 * 3
def test_run_required():
"""
Test all the things that should fail if we pass in --no-run