Skip to content

Commit

Permalink
Issue253 coverage (#564)
Browse files Browse the repository at this point in the history
* add coverage script from Mans with changes based on review in #315 #243

* add unit-test and fix minor bug

* Catch case for no examples
  • Loading branch information
FWuellhorst authored Jun 28, 2024
1 parent eb44eaa commit a600f0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions buildingspy/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ BuildingsPy Changelog
Version 5.2.0, xxxx
^^^^^^^^^^^^^^^^^^^

- In buildingspy/development/regressiontest.py, add option to get the coverage
rate, i.e., what percentage of examples are covered by regression tests.
(https://github.com/lbl-srg/BuildingsPy/issues/253)
- In buildingspy/development/regressiontest.py, add option to create reference
results in batch mode.
(https://github.com/lbl-srg/BuildingsPy/issues/560)
Expand Down
3 changes: 1 addition & 2 deletions buildingspy/development/regressiontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ def getModelicaCommand(self):
elif self._modelica_tool != 'dymola':
return 'jm_ipython.sh'
else:
return "C://Program Files//Dymola 2023x//bin64//Dymola"
return self._modelica_tool

def isExecutable(self, program):
Expand Down Expand Up @@ -4355,7 +4354,7 @@ def getCoverage(self):
) and not filepath.endswith(('package.mo', '.order')):
all_examples.append(filepath)

n_tested_examples = len(temp_data)
n_tested_examples = len(self._data)
n_examples = len(all_examples)
if n_examples > 0:
coverage = round(n_tested_examples / n_examples, 2) * 100
Expand Down

0 comments on commit a600f0c

Please sign in to comment.