diff --git a/hpxml-measures/HPXMLtoOpenStudio/resources/minitest_helper.rb b/hpxml-measures/HPXMLtoOpenStudio/resources/minitest_helper.rb index cee42494c..5138278d2 100644 --- a/hpxml-measures/HPXMLtoOpenStudio/resources/minitest_helper.rb +++ b/hpxml-measures/HPXMLtoOpenStudio/resources/minitest_helper.rb @@ -21,4 +21,4 @@ require 'minitest/autorun' require 'minitest/reporters' require 'minitest/reporters/spec_reporter' # Needed when run via OS CLI -Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress +Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new unless ENV['RM_INFO'] # spec-like progress \ No newline at end of file diff --git a/workflow/tests/resnet_hers_test.rb b/workflow/tests/resnet_hers_test.rb index f631bb004..82d0f070c 100644 --- a/workflow/tests/resnet_hers_test.rb +++ b/workflow/tests/resnet_hers_test.rb @@ -44,8 +44,10 @@ def test_resnet_ashrae_140 htg_loads, clg_loads = _write_ashrae_140_results(all_results, test_results_csv) - # Check results - _check_ashrae_140_results(htg_loads, clg_loads) + # Check results if we have them all + if all_results.size > 1 + _check_ashrae_140_results(htg_loads, clg_loads) + end end def test_resnet_hers_reference_home_auto_generation @@ -98,8 +100,10 @@ def test_resnet_hvac hvac_energy = _write_hers_hvac_results(all_results, test_results_csv) - # Check results - _check_hvac_test_results(hvac_energy) + # Check result if we have them all + if all_results.size > 1 + _check_hvac_test_results(hvac_energy) + end end def test_resnet_dse @@ -125,8 +129,10 @@ def test_resnet_dse dse_energy = _write_hers_dse_results(all_results, test_results_csv) - # Check results - _check_dse_test_results(dse_energy) + # Check results if we have them all + if all_results.size > 1 + _check_dse_test_results(dse_energy) + end end def test_resnet_hot_water @@ -148,7 +154,9 @@ def test_resnet_hot_water dhw_energy = _write_hers_hot_water_results(all_results, test_results_csv) - # Check results - _check_hot_water(dhw_energy) + # Check results if we have them all + if all_results.size > 1 + _check_hot_water(dhw_energy) + end end end diff --git a/workflow/tests/resnet_other_test.rb b/workflow/tests/resnet_other_test.rb index eaeb8f1d3..e715dfddb 100644 --- a/workflow/tests/resnet_other_test.rb +++ b/workflow/tests/resnet_other_test.rb @@ -62,15 +62,20 @@ def test_resnet_hers_iad_home_auto_generation end assert(all_results.size > 0) - # Write results to csv + # Write results to CSV CSV.open(test_results_csv, 'w') do |csv| - csv << ['Component', 'Test 1 Results', 'Test 2 Results', 'Test 3 Results', 'Test 4 Results'] - all_results['01-L100.xml'].keys.each do |component| - csv << [component, - all_results['01-L100.xml'][component], - all_results['02-L100.xml'][component], - all_results['03-L304.xml'][component], - all_results['04-L324.xml'][component]] + # Write the header row with filenames + header = ['Component'] + all_results.keys + csv << header + + # Dynamically get the first file's components + first_file = all_results.keys.first + + # Iterate over the components in the first file + all_results[first_file].keys.each do |component| + # Gather results from all files for the current component + row = [component] + all_results.keys.map { |file| all_results[file][component] } + csv << row end end puts "Wrote results to #{test_results_csv}." diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb index bf92f75c0..845741641 100644 --- a/workflow/tests/util.rb +++ b/workflow/tests/util.rb @@ -192,6 +192,7 @@ def _run_workflow(xml, test_name, timeseries_frequency: 'none', component_loads: run_log.each do |log_line| next unless log_line.include? 'OS Message:' next if log_line.include?('OS Message: Minutes field (60) on line 9 of EPW file') + next if log_line.include?('OS Message: Error removing temporary directory at') flunk "Unexpected warning found in #{log_path} run.log: #{log_line}" end @@ -309,15 +310,20 @@ def _test_resnet_hers_reference_home_auto_generation(test_name, dir_name, versio end assert(all_results.size > 0) - # Write results to csv + # Write results to CSV CSV.open(test_results_csv, 'w') do |csv| - csv << ['Component', 'Test 1 Results', 'Test 2 Results', 'Test 3 Results', 'Test 4 Results'] - all_results['01-L100.xml'].keys.each do |component| - csv << [component, - all_results['01-L100.xml'][component], - all_results['02-L100.xml'][component], - all_results['03-L304.xml'][component], - all_results['04-L324.xml'][component]] + # Write the header row with filenames + header = ['Component'] + all_results.keys + csv << header + + # Dynamically get the first file's components + first_file = all_results.keys.first + + # Iterate over the components in the first file + all_results[first_file].keys.each do |component| + # Gather results from all files for the current component + row = [component] + all_results.keys.map { |file| all_results[file][component] } + csv << row end end puts "Wrote results to #{test_results_csv}."