Skip to content

[v3-3-test] Export AIRFLOW_TEST_MODE from airflow tasks test without --env-vars (#72291) - #72320

Merged
henry3260 merged 1 commit into
v3-3-testfrom
backport-6402213-v3-3-test
Aug 31, 2026
Merged

henry3260 merged 1 commit into
v3-3-testfrom
backport-6402213-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • Export AIRFLOW_TEST_MODE from airflow tasks test without --env-vars

The test-mode signal has been hostage to an unrelated flag since it was
introduced in 2020, so Dag code that branches on it never saw it during a
plain airflow tasks test run. In Airflow 3 this is the only working
test-mode signal, because the test_mode task-context variable is
currently disabled.

  • Stop the env-vars test leaking its writes into the pytest session

monkeypatch.delenv records an undo entry only when the key is already set,
so on a clean worker the values task_test writes to the real process
environment survived teardown. Seeding a sentinel instead also tightens the
assertion: the command now has to overwrite a pre-existing value rather than
merely populate an absent one.


(cherry picked from commit 6402213)

Co-authored-by: Y-C easoneason0905@gmail.com
Co-authored-by: Eason09053360 185830721+Eason09053360@users.noreply.github.com

…--env-vars (#72291)

* Export AIRFLOW_TEST_MODE from airflow tasks test without --env-vars

The test-mode signal has been hostage to an unrelated flag since it was
introduced in 2020, so Dag code that branches on it never saw it during a
plain `airflow tasks test` run. In Airflow 3 this is the only working
test-mode signal, because the `test_mode` task-context variable is
currently disabled.

* Stop the env-vars test leaking its writes into the pytest session

monkeypatch.delenv records an undo entry only when the key is already set,
so on a clean worker the values task_test writes to the real process
environment survived teardown. Seeding a sentinel instead also tightens the
assertion: the command now has to overwrite a pre-existing value rather than
merely populate an absent one.

---------
(cherry picked from commit 6402213)

Co-authored-by: Y-C <easoneason0905@gmail.com>
Co-authored-by: Eason09053360 <185830721+Eason09053360@users.noreply.github.com>
@henry3260
henry3260 merged commit f543ffd into v3-3-test Aug 31, 2026
67 checks passed
@henry3260
henry3260 deleted the backport-6402213-v3-3-test branch August 31, 2026 11:24
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
…--env-vars (#72291) (#72320)

* Export AIRFLOW_TEST_MODE from airflow tasks test without --env-vars

The test-mode signal has been hostage to an unrelated flag since it was
introduced in 2020, so Dag code that branches on it never saw it during a
plain `airflow tasks test` run. In Airflow 3 this is the only working
test-mode signal, because the `test_mode` task-context variable is
currently disabled.

* Stop the env-vars test leaking its writes into the pytest session

monkeypatch.delenv records an undo entry only when the key is already set,
so on a clean worker the values task_test writes to the real process
environment survived teardown. Seeding a sentinel instead also tightens the
assertion: the command now has to overwrite a pre-existing value rather than
merely populate an absent one.

---------
(cherry picked from commit 6402213)

Co-authored-by: Y-C <easoneason0905@gmail.com>
Co-authored-by: Eason09053360 <185830721+Eason09053360@users.noreply.github.com>
@vatsrahul1001 vatsrahul1001 added the type:misc/internal Changelog: Misc changes that should appear in change log label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:CLI type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants