Skip to content

Commit 6f46dd1

Browse files
committed
++
1 parent a457c66 commit 6f46dd1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tests/simulator/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ phare_python3_exec(9 data-wrangler data_wrangler.py ${CMAKE_CURREN
1212
phare_python3_exec(9 sim-refineParticlNbr refined_particle_nbr.py ${CMAKE_CURRENT_BINARY_DIR})
1313
add_no_mpi_python3_test(periodicity test_init_periodicity.py ${CMAKE_CURRENT_BINARY_DIR})
1414

15+
# has to be serial, to run secondary mpirun internally
16+
add_no_mpi_python3_test(initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
17+
1518
if(HighFive)
1619
## These test use dump diagnostics so require HighFive!
1720
phare_python3_exec(9 diagnostics test_diagnostics.py ${CMAKE_CURRENT_BINARY_DIR}) # serial or n = 2
@@ -26,7 +29,6 @@ if(HighFive)
2629
# doesn't make sense in serial
2730
phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR})
2831

29-
phare_mpi_python3_exec(9 2 initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
3032
endif(testMPI)
3133

3234
phare_python3_exec(11, test_diagnostic_timestamps test_diagnostic_timestamps.py ${CMAKE_CURRENT_BINARY_DIR})

tests/simulator/test_init_from_restart.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@
22
import copy
33
import unittest
44
import subprocess
5-
import numpy as np
65
import pyphare.pharein as ph
76

87
from pyphare.simulator.simulator import Simulator
9-
from pyphare.core import phare_utilities as phut
108
from pyphare.pharesee.hierarchy.fromh5 import get_all_available_quantities_from_h5
11-
from pyphare.pharesee.particles import single_patch_per_level_per_pop_from
12-
from pyphare.pharesee.hierarchy.hierarchy_utils import (
13-
flat_finest_field,
14-
single_patch_for_LO,
15-
hierarchy_compare,
16-
)
17-
9+
from pyphare.pharesee.hierarchy.hierarchy_utils import single_patch_for_LO
10+
from pyphare.pharesee.hierarchy.hierarchy_utils import hierarchy_compare
1811
from tests.simulator import SimulatorTest, test_restarts
1912
from tests.diagnostic import dump_all_diags
2013

14+
2115
timestep = 0.001
2216
time_step_nbr = 1
2317
first_mpi_size = 4
@@ -88,9 +82,13 @@ def run_first_sim():
8882

8983
def launch():
9084
"""Launch secondary process to run first simulation to avoid initalizing MPI now"""
91-
cmd = f"mpirun -n {first_mpi_size} python3 -O tests/simulator/test_init_from_restart.py lol"
92-
proc = subprocess.run(cmd.split(" "), check=True, capture_output=True)
93-
return (proc.stdout + proc.stderr).decode().strip()
85+
86+
cmd = f"mpirun -n {first_mpi_size} python3 -O {__file__} lol"
87+
try:
88+
p = subprocess.run(cmd.split(" "), check=True, capture_output=True)
89+
print(p.stdout, p.stderr)
90+
except subprocess.CalledProcessError as e:
91+
print("CalledProcessError", e)
9492

9593

9694
if __name__ == "__main__":

0 commit comments

Comments
 (0)