From 818e0376e6e24b432b53e3c89da8d14d2945cd5f Mon Sep 17 00:00:00 2001 From: mferrera Date: Mon, 20 Nov 2023 15:42:49 +0100 Subject: [PATCH] CI: Run Komodo tests in the RMS environment Komodo CI tests will now run twice, once in the standard Komodo environment and again in the Roxar environment. Also tried to add a bit more clarity to file paths and `pwd` in the script. The RMS test invocation will fail immediately if roxenvbash fails to be sourced, for whatever reason. --- ci/testkomodo.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/ci/testkomodo.sh b/ci/testkomodo.sh index ea3727869..772a887a0 100644 --- a/ci/testkomodo.sh +++ b/ci/testkomodo.sh @@ -1,35 +1,44 @@ copy_test_files () { - mkdir $CI_TEST_ROOT/testpath/ - - pushd $CI_TEST_ROOT/testpath - cp -r $CI_SOURCE_ROOT/tests tests - cp -r $CI_SOURCE_ROOT/conftest.py conftest.py - ln -s $CI_SOURCE_ROOT/examples - ln -s $CI_SOURCE_ROOT/xtgeo-testdata - git clone --depth=1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata - popd + git clone --depth=1 https://github.com/equinor/xtgeo-testdata $CI_TEST_ROOT/xtgeo-testdata + cp -r $CI_SOURCE_ROOT/tests $CI_TEST_ROOT + cp -r $CI_SOURCE_ROOT/conftest.py $CI_TEST_ROOT + ln -s $CI_SOURCE_ROOT/pyproject.toml $CI_TEST_ROOT/pyproject.toml } install_package () { pip install ".[dev]" } +run_komodo_tests () { + install_package + pytest -n 4 -vv +} + +run_roxar_tests () { + set +e + source /project/res/roxapi/aux/roxenvbash latest + set -e + unset PYTHONPATH + python -m venv roxenv --system-site-packages + source roxenv/bin/activate + install_package + pytest -n 4 -vv +} + start_tests () { - pushd $CI_TEST_ROOT/testpath - pytest -n auto -vv + pushd $CI_TEST_ROOT + run_komodo_tests + run_roxar_tests popd } cleanup () { - rm -rf $CI_TEST_ROOT/testpath/../xtgeo-testdata + rm -rf $CI_TEST_ROOT/xtgeo-testdata + rm -rf $CI_TEST_ROOT/roxenv } run_tests() { copy_test_files - - install_package - - pushd $CI_TEST_ROOT start_tests cleanup }