FIX: Add infrastructure for python tests (#91)

Also integrated with CI and runs tests in documentation
This commit is contained in:
Nicolás Hatcher Andrés
2024-09-21 15:46:32 +02:00
committed by GitHub
parent 11df4a55c7
commit bf9a1ed9f4
8 changed files with 79 additions and 8 deletions

29
bindings/python/run_examples.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Define the directory containing the Python files
EXAMPLES_DIR="docs/examples"
# Check if the directory exists
if [ ! -d "$EXAMPLES_DIR" ]; then
echo "Directory $EXAMPLES_DIR does not exist."
exit 1
fi
# Iterate over all Python files in the examples directory
for file in "$EXAMPLES_DIR"/*.py; do
# Check if there are any Python files
if [ -f "$file" ]; then
echo "Running $file..."
python "$file"
# Check if the script ran successfully
if [ $? -ne 0 ]; then
echo "Error running $file"
else
echo "$file ran successfully"
fi
else
echo "No Python files found in $EXAMPLES_DIR"
exit 1
fi
done