def test_job_flag_load_float(): """Test ensures floating point values are handled correctly for load average""" args = "pkg1 pkg2 --load-average=1.23" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util( "--load-average=1.23", filtered), JOB_FLAG_ERR % args args = "-l2 pkg1 pkg2 --load-average=1.23 --no-deps --load-average=1 --load-average -l" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util( "-l2 --load-average=1.23 --load-average=1 --load-average -l", filtered), JOB_FLAG_ERR % args
def test_job_flag_filtering_empty_jl(): """Test ensures proper capture of -j/-l args without a value (accepted by GNU Make)""" args = "pkg1 pkg2 -j" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("-j", filtered), JOB_FLAG_ERR % args args = "pkg1 pkg2 -l" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("-l", filtered), JOB_FLAG_ERR % args args = "--jobs pkg1 --verbose --no-deps pkg2 --load-average --dry-run --start-with pkg1" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("--jobs --load-average", filtered), JOB_FLAG_ERR % args
def test_job_flag_filtering_jl_packages(): """Test ensures packages that start with `j` or `l` are not converted to make job args:""" args = "jpkg lpkg -j1 -l1" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("-j1 -l1", filtered), JOB_FLAG_ERR % args args = "--jobs=1 j2pkg l2pkg --load-average=1" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("--jobs=1 --load-average=1", filtered), JOB_FLAG_ERR % args args = "--jobs=1 j2pkg --verbose --no-deps l2pkg --load-average=1 --dry-run --start-with j2pkg" filtered = extract_jobs_flags(args) assert check_only_strings_in_list_util("--jobs=1 --load-average=1", filtered), JOB_FLAG_ERR % args
def test_no_job_flag(): args = "jpkg1 lpkg2" filtered = extract_jobs_flags(args) assert filtered is None, JOB_FLAG_ERR % args