diff --git a/synthtool/gcp/templates/python_library/.kokoro/test-samples.sh b/synthtool/gcp/templates/python_library/.kokoro/test-samples.sh index 16859b1fa..a65cd7575 100755 --- a/synthtool/gcp/templates/python_library/.kokoro/test-samples.sh +++ b/synthtool/gcp/templates/python_library/.kokoro/test-samples.sh @@ -28,6 +28,12 @@ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then git checkout $LATEST_RELEASE fi +# Exit early if samples directory doesn't exist +if [ ! -d "./samples" ]; then + echo "No tests run. `./samples` not found" + exit 0 +fi + # Disable buffering, so that the logs stream through. export PYTHONUNBUFFERED=1 @@ -101,4 +107,4 @@ cd "$ROOT" # Workaround for Kokoro permissions issue: delete secrets rm testing/{test-env.sh,client-secrets.json,service-account.json} -exit "$RTN" \ No newline at end of file +exit "$RTN"