Skip to content

Commit

Permalink
Test for an error that is still raised
Browse files Browse the repository at this point in the history
This is needed since we now automatically expand objects if required.
  • Loading branch information
jamiebull1 authored and jamiebull1 committed Sep 14, 2019
1 parent 122853d commit 85a0271
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions eppy/tests/test_parse_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

import os
import shutil
import sys

from six import StringIO

from eppy.runner.run_functions import parse_error, EnergyPlusRunError


def test_capture_stderr():
tmp_out = StringIO()
sys.stderr = tmp_out
sys.stderr.write("I am in stderr")
msg = parse_error(tmp_out, "C:/notafile")
assert "<File not found>" in msg
assert "I am in stderr" in msg
sys.stderr = sys.__stderr__


def test_capture_real_error(test_idf):
test_idf.newidfobject(
"HVACTemplate:Thermostat",
Name="thermostat VRF",
Heating_Setpoint_Schedule_Name=15,
Constant_Cooling_Setpoint=25,
)
rundir = "test_capture_real_error"
os.mkdir(rundir)
try:
test_idf.run(output_directory=rundir)
except EnergyPlusRunError as e:
assert "invalid Heating Setpoint Temperature Schedule" in str(e)
finally:
shutil.rmtree(rundir)

0 comments on commit 85a0271

Please sign in to comment.