This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new 0334f43d [infra] Guard uv in e2e.sh and fix the pytest log level in 
ut.sh (#986)
0334f43d is described below

commit 0334f43da2e8e319406c9cde6528e260ce68d993
Author: Weiqing Yang <[email protected]>
AuthorDate: Sun Aug 9 23:54:35 2026 -0700

    [infra] Guard uv in e2e.sh and fix the pytest log level in ut.sh (#986)
    
    Generated-by: Claude Code 2.1.226
---
 tools/e2e.sh | 23 ++++++++++++++++-------
 tools/ut.sh  |  6 +++---
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/tools/e2e.sh b/tools/e2e.sh
index 5a5c7713..e837c5e0 100755
--- a/tools/e2e.sh
+++ b/tools/e2e.sh
@@ -45,7 +45,7 @@ function run_agent_plan_compatibility_test {
     return 1
   fi
 
-  cd "$python_dir" && uv run --no-sync bash 
../e2e-test/test-scripts/test_agent_plan_compatibility.sh "$tempdir" "$jar_path"
+  cd "$python_dir" && "${UV[@]}" run --no-sync bash 
../e2e-test/test-scripts/test_agent_plan_compatibility.sh "$tempdir" "$jar_path"
 }
 
 function run_cross_language_config_test {
@@ -54,7 +54,7 @@ function run_cross_language_config_test {
     return 1
   fi
 
-  cd "$python_dir" && uv run --no-sync bash 
../e2e-test/test-scripts/test_java_config_in_python.sh
+  cd "$python_dir" && "${UV[@]}" run --no-sync bash 
../e2e-test/test-scripts/test_java_config_in_python.sh
 }
 
 function run_resource_cross_language_test_in_java {
@@ -66,13 +66,13 @@ function run_resource_cross_language_test_in_java {
   cd "$python_dir"
 
   # Get Python version from uv's virtual environment and set PYTHONPATH
-  local python_version=$(uv run --no-sync python -c "import sys; 
print(f'python{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null)
+  local python_version=$("${UV[@]}" run --no-sync python -c "import sys; 
print(f'python{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null)
   if [[ -n "$python_version" ]]; then
     export 
PYTHONPATH="$python_dir/.venv/lib/$python_version/site-packages:$PYTHONPATH"
     echo "PYTHONPATH set to: $PYTHONPATH"
   fi
 
-  uv run --no-sync bash 
../e2e-test/test-scripts/test_resource_cross_language.sh
+  "${UV[@]}" run --no-sync bash 
../e2e-test/test-scripts/test_resource_cross_language.sh
 }
 
 function run_resource_cross_language_test_in_python {
@@ -81,7 +81,7 @@ function run_resource_cross_language_test_in_python {
       return 1
     fi
 
-    cd "$python_dir" && uv run --no-sync pytest flink_agents -s -k 
"e2e_tests_resource_cross_language" --reruns 2 --reruns-delay 5
+    cd "$python_dir" && "${UV[@]}" run --no-sync pytest flink_agents -s -k 
"e2e_tests_resource_cross_language" --reruns 2 --reruns-delay 5
 }
 
 function run_resource_name_consistency_check {
@@ -90,7 +90,7 @@ function run_resource_name_consistency_check {
     return 1
   fi
 
-  cd "$python_dir" && uv run --no-sync python 
../e2e-test/test-scripts/check_resource_consistency.py
+  cd "$python_dir" && "${UV[@]}" run --no-sync python 
../e2e-test/test-scripts/check_resource_consistency.py
 }
 
 export TOTAL=0
@@ -121,6 +121,15 @@ fi
 
 cd ..
 
+if command -v uv >/dev/null 2>&1; then
+  UV=(uv)
+elif python3 -m uv --version >/dev/null 2>&1; then
+  UV=(python3 -m uv)
+else
+  echo "Error: uv not found. Run tools/build.sh first, or install uv." >&2
+  exit 1
+fi
+
 # Create temporary directory with better cross-platform compatibility
 if command -v mktemp >/dev/null 2>&1; then
   tempdir=$(mktemp -d)
@@ -153,7 +162,7 @@ if [[ ! -d "$python_dir" ]]; then
 fi
 
 cd "$python_dir"
-uv pip install apache-flink~=${DEFAULT_FLINK_VERSION}.0
+"${UV[@]}" pip install --python .venv apache-flink~=${DEFAULT_FLINK_VERSION}.0
 
 export JVM_ARGS="${JVM_ARGS} --add-exports 
java.base/jdk.internal.vm=ALL-UNNAMED"
 
diff --git a/tools/ut.sh b/tools/ut.sh
index b5ea0116..d413507b 100755
--- a/tools/ut.sh
+++ b/tools/ut.sh
@@ -279,10 +279,10 @@ python_tests() {
                 echo "Running tests with pytest..."
             fi
             if $run_e2e; then
-                python3 -m pytest flink_agents -k "e2e_tests_integration" 
--reruns 2 --reruns-delay 5 -o log_cli=true -o log_cli_level=${LOG_LEVEL:-OFF}
+                python3 -m pytest flink_agents -k "e2e_tests_integration" 
--reruns 2 --reruns-delay 5 -o log_cli=true -o 
log_cli_level=${LOG_LEVEL:-CRITICAL}
                 rc1=$?
                 # Arm 2: integration-marked tests; trap exit code 5 as failure.
-                python3 -m pytest flink_agents -m "integration" -o 
log_cli=true -o log_cli_level=${LOG_LEVEL:-OFF}
+                python3 -m pytest flink_agents -m "integration" -o 
log_cli=true -o log_cli_level=${LOG_LEVEL:-CRITICAL}
                 rc2=$?
                 if [ $rc2 -eq 5 ]; then rc2=1; fi
                 # Logical-OR aggregation: any nonzero exit on either arm 
yields testcode=1.
@@ -291,7 +291,7 @@ python_tests() {
                 # on either arm indicates a selector regression).
                 testcode=$((rc1 || rc2))
             else
-                python3 -m pytest flink_agents -k "not e2e_tests" -m "not 
integration" -o log_cli=true -o log_cli_level=${LOG_LEVEL:-OFF}
+                python3 -m pytest flink_agents -k "not e2e_tests" -m "not 
integration" -o log_cli=true -o log_cli_level=${LOG_LEVEL:-CRITICAL}
                 testcode=$?
             fi
         fi

Reply via email to