From aee5105d645913b440938896b99d353d68e0da15 Mon Sep 17 00:00:00 2001 From: mnt Date: Thu, 7 Sep 2017 11:40:06 +0300 Subject: [PATCH] Prevent multithread test failing if only one CPU core is available --- tests/multithread.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- 2.39.2