summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-03-03 15:23:40 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-03-03 15:23:40 +0100
commit1bad7164d82cbc7705d6158eb2326bf842060ffc (patch)
treee818f429d35a8b3039ea4534d31894d7f45bc259
parentebbf200f4d24391d497dbe66984681c46ad23799 (diff)
downloadpsutil-1bad7164d82cbc7705d6158eb2326bf842060ffc.tar.gz
print
-rwxr-xr-x.ci/travis/run.sh2
-rwxr-xr-xpsutil/tests/runner.py9
2 files changed, 6 insertions, 5 deletions
diff --git a/.ci/travis/run.sh b/.ci/travis/run.sh
index 879e78a6..562564b0 100755
--- a/.ci/travis/run.sh
+++ b/.ci/travis/run.sh
@@ -22,7 +22,7 @@ python setup.py develop
if [[ $PYVER == '2.7' ]] && [[ "$(uname -s)" != 'Darwin' ]]; then
PSUTIL_TESTING=1 python -Wa -m coverage run psutil/tests/runner.py
else
- PSUTIL_TESTING=1 python -Wa psutil/tests/runner.py
+ PSUTIL_TESTING=1 python -Wa psutil/tests/runner.py --parallel
fi
if [ "$PYVER" == "2.7" ] || [ "$PYVER" == "3.6" ]; then
diff --git a/psutil/tests/runner.py b/psutil/tests/runner.py
index 1be62b69..37cd945e 100755
--- a/psutil/tests/runner.py
+++ b/psutil/tests/runner.py
@@ -39,7 +39,7 @@ from psutil.tests import TOX
HERE = os.path.abspath(os.path.dirname(__file__))
VERBOSITY = 1 if TOX else 2
FAILED_TESTS_FNAME = '.failed-tests.txt'
-NPROCS = psutil.cpu_count()
+NWORKERS = psutil.cpu_count() or 1
loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase
@@ -199,9 +199,10 @@ class _Runner:
from concurrencytest import ConcurrentTestSuite, fork_for_tests
ser_suite, par_suite = self.get_parallel_suite()
- par_suite = ConcurrentTestSuite(par_suite, fork_for_tests(NPROCS))
+ par_suite = ConcurrentTestSuite(par_suite, fork_for_tests(NWORKERS))
# run parallel
+ print("starting parallel tests using %s workers" % NWORKERS)
t = time.time()
par = self._run(par_suite)
par_elapsed = time.time() - t
@@ -233,8 +234,8 @@ class _Runner:
+----------+----------+----------+----------+----------+----------+
""" % (par.testsRun, par_fails, par_errs, par_skips, par_elapsed,
ser.testsRun, ser_fails, ser_errs, ser_skips, ser_elapsed)))
- print("Ran %s tests in %.3fs" % (par.testsRun + ser.testsRun,
- par_elapsed + ser_elapsed))
+ print("Ran %s tests in %.3fs using %s workers" % (
+ par.testsRun + ser.testsRun, par_elapsed + ser_elapsed, NWORKERS))
ok = par.wasSuccessful() and ser.wasSuccessful()
self._finalize(ok)
if not ok: