forked from equinor/xtgeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add script for running tests from github worklow (equinor#1296)
* CI: Add script for running tests from github worklow * CI: Include roxar tests * CI: Use xtgeo-testdata from cache
- Loading branch information
1 parent
568b629
commit 7179fc7
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 xtgeo is to be tested towards a new RMS Python enviroment | ||
|
||
run_tests() { | ||
set_test_variables | ||
|
||
copy_test_files | ||
|
||
install_test_dependencies | ||
|
||
run_pytest | ||
} | ||
|
||
set_test_variables() { | ||
echo "Setting variables for xtgeo tests..." | ||
CI_TEST_ROOT=$CI_ROOT/xtgeo_test_root | ||
} | ||
|
||
copy_test_files () { | ||
echo "Copy xtgeo test files to $CI_TEST_ROOT..." | ||
mkdir -p $CI_TEST_ROOT | ||
cp -r $PROJECT_ROOT/tests $CI_TEST_ROOT | ||
|
||
echo "Create symlinks from $CI_TEST_ROOT to files in $PROJECT_ROOT..." | ||
ln -s $PROJECT_ROOT/examples $CI_TEST_ROOT/examples | ||
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 ".[dev]" | ||
|
||
echo "Dependencies installed successfully. Listing installed dependencies..." | ||
pip list | ||
} | ||
|
||
run_pytest () { | ||
echo "Running xtgeo tests with pytest..." | ||
pushd $CI_TEST_ROOT | ||
pytest ./tests -n 4 -vv --testdatapath $XTGEO_TESTDATA_PATH | ||
popd | ||
} |