Skip to content

Commit

Permalink
Added environment variable to help CI find the example folder
Browse files Browse the repository at this point in the history
  • Loading branch information
pariterre committed Feb 28, 2025
1 parent b14547f commit 3f523d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/run_casadi_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test/binding/python3
export CI_MAIN_EXAMPLES_FOLDER=$BIORBD_FOLDER/$EXAMPLES_FOLDER
pytest .
cd $BIORBD_FOLDER
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run_eigen_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ jobs:
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test/binding/python3
export CI_MAIN_EXAMPLES_FOLDER=$BIORBD_FOLDER/$EXAMPLES_FOLDER
pytest .
cd $BIORBD_FOLDER
Expand Down
6 changes: 5 additions & 1 deletion test/binding/python3/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
def load_example_file(file_name: str):
# Import the file as a module from the path
import os
from pathlib import Path
from importlib.util import spec_from_file_location, module_from_spec
import sys

# Get the path to the examples
examples_path = Path(__file__).parent.parent.parent.parent / "examples" / "python3"
if os.environ.get("CI_MAIN_EXAMPLES_FOLDER"):
examples_path = Path(os.environ["CI_MAIN_EXAMPLES_FOLDER"]) / "python3"
else:
examples_path = Path(__file__).parent.parent.parent.parent / "examples" / "python3"

# Import the example
sys.path.append(str(examples_path))
Expand Down

0 comments on commit 3f523d9

Please sign in to comment.