-
Notifications
You must be signed in to change notification settings - Fork 37
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
Code coverage #377
Code coverage #377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there might be a path issue in the main script, otherwise this work is looking great!
cmd += f' {self.heron_driver} {heron_inp}' | ||
python = self._get_python_command() | ||
# python-command is for running HERON; python_command_for_raven is for running RAVEN inner | ||
cmd += f' {self.heron_driver} --python-command="{python}" --python_command_for_raven="{python}" {heron_inp}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering if there is a scenario where the --python-comand
and --python_command_for_raven
would ever be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know of a current practical scenario where a user would want to make them different. To provide a relatively impractical example, this could allow users to check what functions in HERON are called from within the raven inner. This would be done by using some form of coverage run
as the python_command_for_raven
, but keeping python_command
as something like python
. The idea was to maximize the flexibility of the new functionality for future use cases. If this flexibility is removed, some of the changed files could be simplified, which could be worth it. Also, there would be no reduction of flexibility from the current code; prior to this PR, it has assumed that the python commands will be the same.
check_py_coverage.sh
Outdated
#!/bin/bash | ||
SCRIPT_DIRNAME=`dirname $0` | ||
SCRIPT_DIR=`(cd $SCRIPT_DIRNAME; pwd)` | ||
source $SCRIPT_DIR/../../scripts/establish_conda_env.sh --quiet --load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried running this on my local machine, I believe the path to the establish_conda_env.sh
here is set up to run with the HERON plugin version (i.e., the script thinks it is in raven/plugins/HERON
and wants to find the raven/scripts/establish_conda_env.sh
). this should be more generalized to run in a git cloned HERON version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM
Pull Request Description
What issue does this change request address?
#376
What are the significant changes in functionality due to this change request?
This request implements the necessary changes to support functionality of a code coverage script (
HERON/check_py_coverage.sh
). A screenshot of a coverage report produced by this script is attached below. Running the script also prints the location of the complete resulting html report. The script checks the coverage both of HERON functions called before RAVEN outer is run as well as HERON functions called within the run of RAVEN inner (as a side note, these are mostly dispatch-related functions).Pre-RAVEN outer coverage tracking
RAVEN/run_tests
with HERON tests only and provides the python command that is eventually passed as an argument toRAVEN/rook/main.py
(note, rook uses this to set the python command in the testers). The source for coverage measurement is all files in theHERON/src/
directory and in theHERON/templates/
directory, as well as those files in any subdirectory of these two that has an__init__.py
file inside it. Exceptions to this are explicitly listed asHERON/src/ARMABypass.py
and the threetwin_pyomo
tests inHERON/src/dispatch/
.HERON/tests/
has been updated to document information about code coverage.HERONIntegration
tester has been modified to pass a command line argument to theHERON/heron
shell script with a python command for runningHERON/src/main.py
.HERON/heron
shell script has been modified to use the python command provided in the new optional command line argument if it exists.Coverage tracking during RAVEN inner
HERONIntegration
tester has been modified to pass a second command line argument to theHERON/heron
shell script providing the python command with which to runRAVEN/raven_framework.py
on the RAVEN inner input xml script. Both command line arguments (this and the argument mentioned above to specify the python command for runningHERON/src/main.py
) are set to the same string, namely thepython_command
variable in the tester.HERON/heron
shell script toHERON/src/main.py
. TheHERON/src/main.py
script has been modified to recognize this argument and set a variable inHERON/src/Cases.py
to its value.HERON/src/Cases.py
script has been modified with an initialization, getter, and setter for the above mentioned variable.HERON/templates/template_driver.py
has been modified to check whether the case has a specified python command for running RAVEN (the variable in the above bullet). If it exists, a line is added to theouter.xml
that prepends the python command to the command to run the RAVEN inner.For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.