Skip to content

Commit

Permalink
Added test_output_written
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-abrahao committed Aug 10, 2023
1 parent 3bcd930 commit c4ccfaf
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/integration/test_run_clim_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,46 @@ def test_historical_eval_period_out_of_order(
"`period` must be a string of the form 'YYYY-YYYY' (with the first year being "
"less than or equal to the second), we received 2014-1995"
)

def test_output_written(
tmpdir, test_data_dir, fair_slim_configs_filepath, fair_common_configs_filepath
):
out_dir = str(tmpdir)
inp_file = os.path.join(
test_data_dir,
"workflow-fair",
"ex2_harmonized_infilled.csv",
)

fair_version = "1.6.2"

runner = CliRunner()
result = runner.invoke(
climate_assessment.cli.clim_cli,
[
inp_file,
out_dir,
"--num-cfgs",
1,
"--test-run",
"--model",
"fair",
"--model-version",
fair_version,
"--probabilistic-file",
fair_slim_configs_filepath,
"--fair-extra-config",
fair_common_configs_filepath,
"--scenario-batch-size",
4,
"--historical-warming",
0.8,
"--save-csv-combined-output"
],
)

out_csv_fname = os.path.join(out_dir, "ex2_harmonized_infilled_rawoutput.csv")
out_xls_fname = os.path.join(out_dir, "ex2_harmonized_infilled_rawoutput.xlsx")

assert os.path.isfile(out_xls_fname), f"XLS output not written:"
assert os.path.isfile(out_csv_fname), f"--save-csv-combined-output was set but CSV output not written:"

0 comments on commit c4ccfaf

Please sign in to comment.