From: mnt Date: Thu, 7 Sep 2017 08:40:06 +0000 (+0300) Subject: Prevent multithread test failing if only one CPU core is available X-Git-Tag: V8_4_0a2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aee5105d645913b440938896b99d353d68e0da15;p=plugins%2Fblsurfplugin.git Prevent multithread test failing if only one CPU core is available --- diff --git a/tests/multithread.py b/tests/multithread.py index 62e8f0a..3d75848 100644 --- a/tests/multithread.py +++ b/tests/multithread.py @@ -4,10 +4,13 @@ import os import sys import salome import time +import multiprocessing salome.salome_init() theStudy = salome.myStudy +cpu_count = multiprocessing.cpu_count() + ### ### GEOM component ### @@ -77,7 +80,10 @@ time3 = time.time() time_singlethread = time3-time2 print "Time in 1 proc: %.3s"%(time_singlethread) -assert time_multithread < time_singlethread/2. +if cpu_count == 1: + print "Warning: cannot validate test - only 1 cpu core is available" +else: + assert time_multithread < time_singlethread/2. if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(True)