Skip to content

Commit

Permalink
Avoid race conditions in Polar Poisson tests
Browse files Browse the repository at this point in the history
Closes #385

See merge request gysela-developpers/gyselalibxx!743

--------------------------------------------
  • Loading branch information
Geoflow committed Oct 25, 2024
1 parent cb4b494 commit 14f5e30
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/geometryRTheta/polar_poisson/test_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
"""
import subprocess
import sys
import pathlib

import numpy as np

executable = sys.argv[1]
exe_path=pathlib.PurePath(executable)
test_case=exe_path.stem.removeprefix('polar_poisson_convergence_')
input_file=test_case+".yaml"

with open("poisson.yaml", "w", encoding="utf-8") as f:
with open(input_file, "w", encoding="utf-8") as f:
print("SplineMesh:", file=f)
print(" r_ncells: 32", file=f)
print(" p_ncells: 32", file=f)

with subprocess.Popen([executable, "poisson.yaml"], stdout=subprocess.PIPE) as p:
with subprocess.Popen([executable, input_file], stdout=subprocess.PIPE) as p:
out, err = p.communicate()
out = out.decode('ascii').strip()

Expand All @@ -29,12 +33,12 @@
out_lines = out.split('\n')
error_32 = [float(l.split(' ')[3]) for l in out_lines if "Max error :" in l][0]

with open("poisson.yaml", "w", encoding="utf-8") as f:
with open(input_file, "w", encoding="utf-8") as f:
print("SplineMesh:", file=f)
print(" r_ncells: 64", file=f)
print(" p_ncells: 64", file=f)

with subprocess.Popen([executable, "poisson.yaml"], stdout=subprocess.PIPE) as p:
with subprocess.Popen([executable, input_file], stdout=subprocess.PIPE) as p:
out, err = p.communicate()
out = out.decode('ascii').strip()

Expand Down

0 comments on commit 14f5e30

Please sign in to comment.