fix(parse): handle PYTEST_THEME env var in DAG integrity test#2028
Merged
fix(parse): handle PYTEST_THEME env var in DAG integrity test#2028
Conversation
When running `astro dev parse`, the monkeypatched os.getenv() returns MOCKED_PYTEST_THEME_VALUE for unset environment variables. Pytest validates PYTEST_THEME against known Pygment styles and fails with: ERROR: PYTEST_THEME environment variable had an invalid value: 'MOCKED_PYTEST_THEME_VALUE'. Only valid pygment styles are allowed. This occurs when Astro projects specify "--color=yes" in pytest configs, causing pytest to check the PYTEST_THEME environment variable. Solution: Return None for PYTEST_THEME when no default is provided, following the same pattern used for the JENKINS_HOME fix (#601). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
josh-fell
commented
Mar 5, 2026
jlaneve
approved these changes
Mar 5, 2026
b708c5d to
029b3af
Compare
Pull Request Test Coverage Report for Build cfe1dabf-371b-4ee1-8611-3f65c75e05a5Details
💛 - Coveralls |
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.
Fixes a bug where
astro dev parsefails when projects specify--color=yesin their pytest configuration. The monkeypatchedos.getenv()in the DAG integrity test templates returnsMOCKED_PYTEST_THEME_VALUEfor unset environment variables, which pytest validates against known Pygment styles and rejects. This change adds special handling forPYTEST_THEME(similar to the existingJENKINS_HOMEfix from #601), returningNonewhen the variable is unset instead of a mocked value.🎟 Issue(s)
Resolves a bug where pytest fails with:
Related to #601 (similar fix pattern for JENKINS_HOME)
🧪 Functional Testing
Create an Astro project with pytest configured to use
--color=yes:Add to
pytest.iniorpyproject.toml:Run parse command:
Verify it completes successfully without PYTEST_THEME error
Before this fix: Command fails with "PYTEST_THEME environment variable had an invalid value"
After this fix: Command succeeds and DAGs parse correctly
📸 Screenshots
N/A - This is a bug fix that prevents an error message, no visual changes
📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draftFiles Changed
airflow/include/airflow2/dagintegritytestdefault.py- Added PYTEST_THEME special caseairflow/include/airflow3/dagintegritytestdefault.py- Added PYTEST_THEME special casego.mod- Fixed go version format from1.24.0to1.24Notes for Reviewers
This follows the exact same pattern as the JENKINS_HOME fix that was added for issue #601. The monkeypatch templates already have infrastructure for handling environment variables that need special treatment - this simply adds PYTEST_THEME to that list.