aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_build.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index 0a70018a1..6eb783f59 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -11,6 +11,7 @@
# under the License.
import abc
+import multiprocessing
import os
import sys
@@ -34,7 +35,12 @@ class BuildTest(object):
super(BuildTest, self).setUp()
self.useFixture(log_fixture.SetLogLevel([__name__],
logging.logging.INFO))
- self.build_args = [__name__, "--debug", '--threads', '4']
+
+ self.threads = multiprocessing.cpu_count()
+ if self.threads < 4:
+ self.threads = 4
+
+ self.build_args = [__name__, "--debug", '--threads', str(self.threads)]
@testtools.skipUnless(os.environ.get('DOCKER_BUILD_TEST'),
'Skip the docker build test')