-
Notifications
You must be signed in to change notification settings - Fork 8
CI: Add testrmsenv.sh script for testing against RMS environment
#92
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # This shell script is to be sourced and run from a github workflow | ||
| # when xtgeoviz is to be tested towards a new RMS Python environment | ||
|
|
||
| run_tests() { | ||
| set_test_variables | ||
|
|
||
| copy_test_files | ||
|
|
||
| install_test_dependencies | ||
|
|
||
| run_pytest | ||
| } | ||
|
|
||
| set_test_variables() { | ||
| echo "Setting variables for xtgeoviz tests..." | ||
| CI_TEST_ROOT=$CI_ROOT/xtgeoviz_test_root | ||
| } | ||
|
|
||
| copy_test_files () { | ||
| echo "Copy xtgeoviz test files to $CI_TEST_ROOT..." | ||
| mkdir -p $CI_TEST_ROOT | ||
| ln -s $XTGEO_TESTDATA_PATH $CI_ROOT/xtgeo-testdata | ||
| cp -r $PROJECT_ROOT/tests $CI_TEST_ROOT | ||
|
|
||
| echo "Create symlinks from $CI_TEST_ROOT to files in $PROJECT_ROOT..." | ||
| ln -s $PROJECT_ROOT/conftest.py $CI_TEST_ROOT/conftest.py | ||
| ln -s $PROJECT_ROOT/pyproject.toml $CI_TEST_ROOT/pyproject.toml | ||
| } | ||
|
|
||
| install_test_dependencies () { | ||
| echo "Installing test dependencies..." | ||
| pip install ".[tests]" | ||
|
|
||
| echo "Dependencies installed successfully. Listing installed dependencies..." | ||
| pip list | ||
| } | ||
|
|
||
| run_pytest () { | ||
| echo "Running xtgeoviz tests with pytest..." | ||
| pushd $CI_TEST_ROOT | ||
| pytest ./tests -n 4 -vv --testdatapath $XTGEO_TESTDATA_PATH | ||
| popd | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The xtgeoviz tests still resolve testdata through ../xtgeo-testdata in several places, and in the rms-sys workflow pytest runs from $CI_ROOT/xtgeoviz_test_root while the cached testdata lives at $XTGEO_TESTDATA_PATH. We can add a symlink from $CI_ROOT/xtgeo-testdata to $XTGEO_TESTDATA_PATH before running pytest. The --testdatapath argument is accepted, but it is not used by all xtgeoviz tests.
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.
Done