Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions ci/testrmsenv.sh
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

Copy link
Copy Markdown
Contributor

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.

Suggested change
cp -r $PROJECT_ROOT/tests $CI_TEST_ROOT
ln -s $XTGEO_TESTDATA_PATH $CI_ROOT/xtgeo-testdata
cp -r $PROJECT_ROOT/tests $CI_TEST_ROOT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done


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
}