aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-09-23 09:57:53 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-09-30 18:52:26 +0300
commit5dec06660f822e3f73fe3180298efdc2684922a5 (patch)
tree7c11f5aabf893fec2f5870743e7835deb1eadd67 /tests
parentStaticSrcUri: handle more cases (diff)
downloadpkgcheck-5dec06660f822e3f73fe3180298efdc2684922a5.tar.gz
pkgcheck-5dec06660f822e3f73fe3180298efdc2684922a5.tar.bz2
pkgcheck-5dec06660f822e3f73fe3180298efdc2684922a5.zip
scan: respect jobs count from MAKEOPTS
When selecting the default `--jobs` value for `pkgcheck scan`, respect `MAKEOPTS`. As a result, it selects the correct value during tests phase. Bug: https://bugs.gentoo.org/799314 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgcheck_scan.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/scripts/test_pkgcheck_scan.py b/tests/scripts/test_pkgcheck_scan.py
index ddec4b0d..9a54ed49 100644
--- a/tests/scripts/test_pkgcheck_scan.py
+++ b/tests/scripts/test_pkgcheck_scan.py
@@ -19,7 +19,7 @@ from pkgcheck.scripts import run
from pkgcore import const as pkgcore_const
from pkgcore.ebuild import atom, restricts
from pkgcore.restrictions import packages
-from snakeoil.contexts import chdir
+from snakeoil.contexts import chdir, os_environ
from snakeoil.fileutils import touch
from snakeoil.formatters import PlainTextFormatter
from snakeoil.osutils import pjoin
@@ -254,6 +254,20 @@ class TestPkgcheckScanParseArgs:
assert not out
assert err.strip() == "pkgcheck scan: error: no default repo found"
+ @pytest.mark.parametrize(('makeopts', 'expected_jobs'), (
+ ('', 4),
+ ('-j1', 1),
+ ('--jobs=6 -l 1', 6),
+ ('--load 1', 4),
+ ))
+ def test_makeopts_parsing(self, parser, makeopts, expected_jobs):
+ with patch('os.cpu_count', return_value=4), \
+ os_environ(MAKEOPTS=makeopts):
+
+ options = parser.parse_args(['scan'])
+ assert options.jobs == expected_jobs
+ assert options.tasks == 5 * expected_jobs
+
class TestPkgcheckScanParseConfigArgs: