From 259108ade8b9a2469d863f0c035eb344457e342a Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Mon, 29 Apr 2024 15:18:30 -0600 Subject: [PATCH] test for error message if no reopt data --- .../test_ditto_reader_cli.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/urbanopt_ditto_reader/test_ditto_reader_cli.py b/tests/urbanopt_ditto_reader/test_ditto_reader_cli.py index 888d93b..d171861 100644 --- a/tests/urbanopt_ditto_reader/test_ditto_reader_cli.py +++ b/tests/urbanopt_ditto_reader/test_ditto_reader_cli.py @@ -48,6 +48,34 @@ def test_upgrade_transformers(capfd): # This text is printed by ditto.consistency.fix_undersized_transformers +def test_graceful_error_if_no_reopt(capfd): + reopt_optimization_file = ( + Path(__file__).parent.parent.parent + / "example" + / "run" + / "baseline_scenario" + / "1" + / "feature_reports" + / "feature_optimization.csv" + ) + assert reopt_optimization_file.exists() is False + subprocess.run( + [ + "ditto_reader_cli", + "run-opendss", + "--config", + "example_config.json", + "--upgrade", + "--reopt", + ], + cwd=examples_dir, + check=True, + ) + captured = capfd.readouterr() + assert "not found" in captured.out + # This text is printed by ditto.consistency.fix_undersized_transformers + + # REopt data for testing not present in this repo as of 2023-04-05 # def test_use_reopt(capfd): # subprocess.run(