Skip to content

Commit

Permalink
Check Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmc committed Nov 21, 2024
1 parent a2c70af commit 7081113
Showing 1 changed file with 31 additions and 35 deletions.
66 changes: 31 additions & 35 deletions tests/dgcv/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,38 @@ def _execute_tool(producer_model, producer_curves, reference_curves):
if reference_curves:
assert (testpath / reference_curves).exists()

try:
config._default_config.set("Dynawo", "simulation_limit", "120")
only_dtr = True
if producer_model:
if "SM" in producer_model:
sim_type = 0
elif "PPM" in producer_model:
sim_type = 0
else:
sim_type = 1
config._default_config.set("Dynawo", "simulation_limit", "120")
only_dtr = True
if producer_model:
if "SM" in producer_model:
sim_type = 0
elif "PPM" in producer_model:
sim_type = 0
else:
sim_type = 1
else:
if "SM" in producer_curves:
sim_type = 0
elif "PPM" in producer_curves:
sim_type = 0
else:
if "SM" in producer_curves:
sim_type = 0
elif "PPM" in producer_curves:
sim_type = 0
else:
sim_type = 1

ep = Parameters(
Path(shutil.which("dynawo.sh")).resolve(),
testpath / producer_model if producer_model else None,
testpath / producer_curves if producer_curves else None,
testpath / reference_curves if reference_curves else None,
None,
output_dir,
only_dtr,
sim_type,
)
md = ModelValidation(ep)

compliance = md.validate(True)
except Exception as e:
compliance = str(e)
finally:
shutil.rmtree(output_dir)
return compliance
sim_type = 1

ep = Parameters(
Path(shutil.which("dynawo.sh")).resolve(),
testpath / producer_model if producer_model else None,
testpath / producer_curves if producer_curves else None,
testpath / reference_curves if reference_curves else None,
None,
output_dir,
only_dtr,
sim_type,
)
md = ModelValidation(ep)

compliance = md.validate(True)
shutil.rmtree(output_dir)
return compliance


def test_perf_sm_model():
Expand Down

0 comments on commit 7081113

Please sign in to comment.