Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Residential: add unit tests for BuildResidentialModel #191

Merged
merged 18 commits into from
Dec 21, 2023
Merged

Conversation

joseph-robertson
Copy link
Collaborator

@joseph-robertson joseph-robertson commented Dec 13, 2023

Add example_project/measures/BuildResidentialModel/tests/test_build_residential_model.rb. Using this test file, we can check combinations of assignments in the args hash (which is what Baseline.rb populates and sends into BuildResidentialModel).

Adds new rake tasks:

  • residential:measure_tests: runs the unit tests found in BuildResidentialModel/tests/test_build_residential_model.rb
  • residential:update_resources: git clones (as opposed to git subtree) the OpenStudio-HPXML repository with a depth of 1 and renames it to "hpxml-measures"

Refactors a bunch of residential -related methods into their own resource files:

  • example_project/mappers/residential:
    • util.rb (contains the general residential method and all residential_xxx category methods)
    • template
      • iecc (contains all the *.tsv files)
      • util.rb (contains residential_template method and related helper methods)

@joseph-robertson joseph-robertson self-assigned this Dec 13, 2023
@joseph-robertson joseph-robertson changed the base branch from develop to os37 December 13, 2023 18:54
@vtnate vtnate marked this pull request as ready for review December 21, 2023 17:11
@vtnate vtnate requested review from vtnate and removed request for vtnate December 21, 2023 17:12
Copy link
Collaborator

@vtnate vtnate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the refactoring is greek to me, but in Joe I trust. I'm psyched to have more tests. 🐄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the magic happens. I love that we have more tests.

@@ -780,4 +780,24 @@ task update_all: [:run_all, :post_process_all, :visualize_all] do
# run and post_process all the scenarios
end

desc 'Run residential tasks'
namespace :residential do
desc 'Update residential resources'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this rake task! This will reduce my anxiety on this step a lot. 🙌

- name: Update gems
run: |
bundle update
bundle exec certified-update
- name: Test residential measure variations
run: bundle exec rake residential:measure_tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So automatic. Such test. Very variety. 👍

@vtnate vtnate merged commit b04b5ce into os37 Dec 21, 2023
9 checks passed
@vtnate vtnate deleted the residential-tests branch December 21, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants