Skip to content

Commit 563c168

Browse files
committed
Merge branch 'develop' into fix-compare-err-substring
2 parents 6e48e5c + e7fcf9d commit 563c168

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/ExpandObjects/tests/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def who_called_me():
8686

8787

8888
class ExpandObjectsResult:
89-
def __init__(self, run_dir: Path):
89+
def __init__(self, run_dir: Path, returncode: int):
9090
self.run_dir = run_dir
91+
self.returncode = returncode
9192

9293
self.idf_text: str = (run_dir / "expanded.idf").read_text()
9394

@@ -137,8 +138,8 @@ def _run(
137138
target_ep_idd_path = run_dir / ep_idd.name
138139
shutil.copy(ep_idd, run_dir / target_ep_idd_path)
139140

140-
subprocess.check_call([str(expandobjectsclipath), idf_file_path], cwd=run_dir)
141+
completed_process = subprocess.run([str(expandobjectsclipath), idf_file_path], cwd=run_dir, check=False)
141142

142-
return ExpandObjectsResult(run_dir=run_dir)
143+
return ExpandObjectsResult(run_dir=run_dir, returncode=completed_process.returncode)
143144

144145
return _run

src/ExpandObjects/tests/test_ideal_loads_humidistat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def test_ideal_loads_without_exising_humidistat(prepare_and_run_expandobjects):
9292
"""
9393

9494
result: ExpandObjectsResult = prepare_and_run_expandobjects(ori_idf_text=ori_idf_text)
95+
assert result.returncode == 0
9596
assert result.err_text is None, f"ExpandObjects failed with error: {result.err_text}"
9697
assert (
9798
"! HVACTemplate:Zone:IdealLoadsAirSystem," in result.idf_text
@@ -228,6 +229,7 @@ def test_ideal_loads_with_exising_humidistat(prepare_and_run_expandobjects):
228229
60.0; !- Hourly Value
229230
"""
230231
result: ExpandObjectsResult = prepare_and_run_expandobjects(ori_idf_text=ori_idf_text)
232+
assert result.returncode == 0
231233
assert result.err_text is not None
232234
assert (
233235
'ExpandObjects: Warning: In HVACTemplate:Zone:IdealLoadsAirSystem "Zone 1" a ZoneControl:Humidistat named '
@@ -356,6 +358,7 @@ def test_ideal_loads_with_exising_humidistat_but_no_dehum_schedule(prepare_and_r
356358
30.0; !- Hourly Value
357359
"""
358360
result: ExpandObjectsResult = prepare_and_run_expandobjects(ori_idf_text=ori_idf_text)
361+
assert result.returncode == 1
359362
assert result.err_text is not None
360363
assert (
361364
'ExpandObjects: Warning: In HVACTemplate:Zone:IdealLoadsAirSystem "Zone 1" a ZoneControl:Humidistat named '
@@ -438,6 +441,7 @@ def test_ideal_loads_with_exising_humidistat_but_no_hum_schedule(prepare_and_run
438441
60.0; !- Hourly Value
439442
"""
440443
result: ExpandObjectsResult = prepare_and_run_expandobjects(ori_idf_text=ori_idf_text)
444+
assert result.returncode == 1
441445
assert result.err_text is not None
442446
assert (
443447
'ExpandObjects: Warning: In HVACTemplate:Zone:IdealLoadsAirSystem "Zone 1" a ZoneControl:Humidistat named '

0 commit comments

Comments
 (0)