Skip to content

Commit 6c771f7

Browse files
committed
CI: Add testrmsenv.sh script for testing against RMS environment
1 parent 2c4972b commit 6c771f7

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

ci/testrmsenv.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This shell script is to be sourced and run from a github workflow
2+
# when xtgeoviz is to be tested towards a new RMS Python environment
3+
4+
run_tests() {
5+
set_test_variables
6+
7+
copy_test_files
8+
9+
install_test_dependencies
10+
11+
run_pytest
12+
}
13+
14+
set_test_variables() {
15+
echo "Setting variables for xtgeoviz tests..."
16+
CI_TEST_ROOT=$CI_ROOT/xtgeoviz_test_root
17+
}
18+
19+
copy_test_files () {
20+
echo "Copy xtgeoviz test files to $CI_TEST_ROOT..."
21+
mkdir -p $CI_TEST_ROOT
22+
ln -s $XTGEO_TESTDATA_PATH $CI_ROOT/xtgeo-testdata
23+
cp -r $PROJECT_ROOT/tests $CI_TEST_ROOT
24+
25+
echo "Create symlinks from $CI_TEST_ROOT to files in $PROJECT_ROOT..."
26+
ln -s $PROJECT_ROOT/conftest.py $CI_TEST_ROOT/conftest.py
27+
ln -s $PROJECT_ROOT/pyproject.toml $CI_TEST_ROOT/pyproject.toml
28+
}
29+
30+
install_test_dependencies () {
31+
echo "Installing test dependencies..."
32+
pip install ".[tests]"
33+
34+
echo "Dependencies installed successfully. Listing installed dependencies..."
35+
pip list
36+
}
37+
38+
run_pytest () {
39+
echo "Running xtgeoviz tests with pytest..."
40+
pushd $CI_TEST_ROOT
41+
pytest ./tests -n 4 -vv --testdatapath $XTGEO_TESTDATA_PATH
42+
popd
43+
}

0 commit comments

Comments
 (0)