Salome HOME
Check result of Compute() in test and examples
[modules/smesh.git] / doc / examples / creating_parallel_mesh.py
index e837fc9d77b1281f4abf86833cb3e297803c4fe8..809d8ef6922968d293d8c1cb7da87fb142ee300d 100644 (file)
@@ -1,7 +1,11 @@
 # contains function to compute a mesh in parallel
 from platform import java_ver
 import sys
-from tkinter import W
+try:
+    from tkinter import W
+except:
+    print("warning: could not import tkinter")
+
 import salome
 
 import time
@@ -109,14 +113,18 @@ def run_test(nbox=2, boxsize=100):
     print("Starting sequential compute")
     start = time.monotonic()
     is_done = seq_mesh.Compute()
-    assert is_done
+    if not is_done:
+        raise Exception("Error when computing Mesh")
+
     stop = time.monotonic()
     time_seq = stop-start
 
     print("Starting parallel compute")
     start = time.monotonic()
     is_done = par_mesh.Compute()
-    assert is_done
+    if not is_done:
+        raise Exception("Error when computing Mesh")
+
     stop = time.monotonic()
     time_par = stop-start