diff --git a/tests/simulator/CMakeLists.txt b/tests/simulator/CMakeLists.txt index 72d6f1296..b49e86a77 100644 --- a/tests/simulator/CMakeLists.txt +++ b/tests/simulator/CMakeLists.txt @@ -12,6 +12,9 @@ phare_python3_exec(9 data-wrangler data_wrangler.py ${CMAKE_CURREN phare_python3_exec(9 sim-refineParticlNbr refined_particle_nbr.py ${CMAKE_CURRENT_BINARY_DIR}) add_no_mpi_python3_test(periodicity test_init_periodicity.py ${CMAKE_CURRENT_BINARY_DIR}) +# has to be serial, to run secondary mpirun internally +add_no_mpi_python3_test(initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR}) + if(HighFive) ## These test use dump diagnostics so require HighFive! phare_python3_exec(9 diagnostics test_diagnostics.py ${CMAKE_CURRENT_BINARY_DIR}) # serial or n = 2 @@ -26,7 +29,6 @@ if(HighFive) # doesn't make sense in serial phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR}) - phare_mpi_python3_exec(9 2 initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR}) endif(testMPI) phare_python3_exec(11, test_diagnostic_timestamps test_diagnostic_timestamps.py ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/tests/simulator/test_init_from_restart.py b/tests/simulator/test_init_from_restart.py index 82ab70ec8..6653d86c5 100644 --- a/tests/simulator/test_init_from_restart.py +++ b/tests/simulator/test_init_from_restart.py @@ -2,22 +2,16 @@ import copy import unittest import subprocess -import numpy as np import pyphare.pharein as ph from pyphare.simulator.simulator import Simulator -from pyphare.core import phare_utilities as phut from pyphare.pharesee.hierarchy.fromh5 import get_all_available_quantities_from_h5 -from pyphare.pharesee.particles import single_patch_per_level_per_pop_from -from pyphare.pharesee.hierarchy.hierarchy_utils import ( - flat_finest_field, - single_patch_for_LO, - hierarchy_compare, -) - +from pyphare.pharesee.hierarchy.hierarchy_utils import single_patch_for_LO +from pyphare.pharesee.hierarchy.hierarchy_utils import hierarchy_compare from tests.simulator import SimulatorTest, test_restarts from tests.diagnostic import dump_all_diags + timestep = 0.001 time_step_nbr = 1 first_mpi_size = 4 @@ -88,9 +82,13 @@ def run_first_sim(): def launch(): """Launch secondary process to run first simulation to avoid initalizing MPI now""" - cmd = f"mpirun -n {first_mpi_size} python3 -O tests/simulator/test_init_from_restart.py lol" - proc = subprocess.run(cmd.split(" "), check=True, capture_output=True) - return (proc.stdout + proc.stderr).decode().strip() + + cmd = f"mpirun -n {first_mpi_size} python3 -O {__file__} lol" + try: + p = subprocess.run(cmd.split(" "), check=True, capture_output=True) + print(p.stdout, p.stderr) + except subprocess.CalledProcessError as e: + print("CalledProcessError", e) if __name__ == "__main__":