Commit dc341091 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: test num_jobs initialisation

parent 9b380b88
......@@ -7,6 +7,8 @@
import os.path as op
from unittest import mock
import funpack.config as config
import funpack.custom as custom
......@@ -30,3 +32,16 @@ def test_parseArgs_fixPath():
args = config.parseArgs(argv)[0]
assert args.variable_file == [fullpath, fullpath, fullpath]
@clear_plugins
def test_num_jobs():
custom.registerBuiltIns()
with mock.patch('multiprocessing.cpu_count', return_value=99):
assert config.parseArgs('-nj -1 out in'.split())[0].num_jobs == 99
assert config.parseArgs('-nj -5 out in'.split())[0].num_jobs == 99
assert config.parseArgs('-nj 0 out in'.split())[0].num_jobs == 1
assert config.parseArgs('-nj 1 out in'.split())[0].num_jobs == 1
assert config.parseArgs('-nj 5 out in'.split())[0].num_jobs == 5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment