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

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new b6f61b5f859 Fix airflowctl retry env-var tests failing on self-hosted 
runners (#73212)
b6f61b5f859 is described below

commit b6f61b5f859e3fe323829db6949814f9ce782766
Author: Shahar Epstein <[email protected]>
AuthorDate: Tue Sep 15 22:47:41 2026 +0300

    Fix airflowctl retry env-var tests failing on self-hosted runners (#73212)
    
    The module-wide autouse fixture clears os.environ, so the retry tests
    handed a child interpreter an environment with nothing but AIRFLOW_HOME.
    A Python built with --enable-shared then cannot locate libpython unless
    LD_LIBRARY_PATH survives, which is exactly what actions/setup-python
    relies on outside /opt/hostedtoolcache. The tests only passed on
    GitHub-hosted runners because the hardcoded RPATH happened to resolve.
    
    Override the fixture for that class so the child inherits a real
    environment, and drop only the AIRFLOW_CLI_API_* knobs under test so a
    developer's shell cannot influence the result.
---
 airflow-ctl/tests/airflow_ctl/api/test_client.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/airflow-ctl/tests/airflow_ctl/api/test_client.py 
b/airflow-ctl/tests/airflow_ctl/api/test_client.py
index 3db2a46a896..22ad51d796e 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_client.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_client.py
@@ -550,6 +550,24 @@ def 
test_credentials_rejects_unsafe_env_from_environment_variable(monkeypatch, a
 class TestRetryConfigurationEnvVars:
     """The knobs are read at import time, so a bad value used to take down 
even ``--help``."""
 
+    @pytest.fixture(autouse=True)
+    def unique_config_dir(self, monkeypatch, tmp_path):
+        """
+        Override the module fixture, which clears ``os.environ`` wholesale.
+
+        These tests hand the environment to a child interpreter, and starting 
one needs more
+        than ``AIRFLOW_HOME``: a ``--enable-shared`` Python cannot find 
``libpython`` without
+        the ``LD_LIBRARY_PATH`` its installer exported. Only the knobs under 
test are dropped,
+        so a value in the developer's own shell cannot decide the result.
+        """
+        monkeypatch.setenv("AIRFLOW_HOME", str(tmp_path))
+        for name in (
+            "AIRFLOW_CLI_API_RETRIES",
+            "AIRFLOW_CLI_API_RETRY_WAIT_MIN",
+            "AIRFLOW_CLI_API_RETRY_WAIT_MAX",
+        ):
+            monkeypatch.delenv(name, raising=False)
+
     @staticmethod
     def _import_with(**env: str) -> subprocess.CompletedProcess:
         return subprocess.run(

Reply via email to