Repository navigation
[v3-3-test] Export AIRFLOW_TEST_MODE from airflow tasks test without --env-vars (#72291) - #72320
Merged
Merged
Conversation
…--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>
1 task done
henry3260
marked this pull request as ready for review
August 31, 2026 09:17
henry3260
requested review from
bugraoz93,
dheerajturaga,
henry3260 and
potiuk
as code owners
August 31, 2026 09:17
henry3260
approved these changes
Aug 31, 2026
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 testrun. In Airflow 3 this is the only workingtest-mode signal, because the
test_modetask-context variable iscurrently disabled.
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