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

snuyanzin pushed a commit to branch release-2.3
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-2.3 by this push:
     new 8af7b088636 [hotfix][ci] Run pyflink tests in parallel
8af7b088636 is described below

commit 8af7b088636f3b9bad9bb22a9032cf3cd7614133
Author: Sergey Nuyanzin <[email protected]>
AuthorDate: Sat Oct 31 18:19:46 2026 +0100

    [hotfix][ci] Run pyflink tests in parallel
---
 flink-python/conftest.py             | 31 +++++++++++++++++++++++++++++++
 flink-python/dev/integration_test.sh |  2 +-
 flink-python/pyproject.toml          |  1 +
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/flink-python/conftest.py b/flink-python/conftest.py
new file mode 100644
index 00000000000..97eb595b463
--- /dev/null
+++ b/flink-python/conftest.py
@@ -0,0 +1,31 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+import os
+
+
+def pytest_configure(config):
+    # isolate gateway JVM logs per xdist worker
+    worker = os.environ.get("PYTEST_XDIST_WORKER")
+    if not worker:
+        return
+    from pyflink.pyflink_gateway_server import get_log_dir, 
prepare_environment_variables
+    env = dict(os.environ)
+    prepare_environment_variables(env)
+    log_dir = os.path.join(get_log_dir(env), worker)
+    os.makedirs(log_dir, exist_ok=True)
+    os.environ["FLINK_LOG_DIR"] = log_dir
diff --git a/flink-python/dev/integration_test.sh 
b/flink-python/dev/integration_test.sh
index 5689e85fd11..5c1628a71b0 100755
--- a/flink-python/dev/integration_test.sh
+++ b/flink-python/dev/integration_test.sh
@@ -20,7 +20,7 @@
 function test_module() {
     module="$FLINK_PYTHON_DIR/pyflink/$1"
     echo "test module $module"
-    pytest --durations=20 ${module} $2
+    pytest -n ${PYFLINK_TEST_WORKERS:-4} --dist loadfile --durations=20 
${module} $2
     if [[ $? -ne 0 ]]; then
         echo "test module $module failed"
         exit 1
diff --git a/flink-python/pyproject.toml b/flink-python/pyproject.toml
index d2a90694bb9..a5176bf653a 100644
--- a/flink-python/pyproject.toml
+++ b/flink-python/pyproject.toml
@@ -49,6 +49,7 @@ dev = [
   "httplib2>=0.19.0",
   "protobuf~=4.25",
   "pytest~=8.0",
+  "pytest-xdist~=3.6",
   "ruamel.yaml>=0.18.4",
   "typing-extensions>=4.5.0; python_version < '3.12'",
   "typing-extensions>=4.7.0; python_version >= '3.12'",

Reply via email to