-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from jamiebull1/i245_py3_parse_error
I245 py3 parse error
- Loading branch information
Showing
2 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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) |