Bind-mount host dirs in astro dev pytest to match astro dev start#2016
Merged
Bind-mount host dirs in astro dev pytest to match astro dev start#2016
Conversation
Previously, `astro dev pytest` created an ephemeral container and only copied `dags/` and `.astro/` into it via `docker cp`. This meant `tests/`, `plugins/`, and `include/` were only available if baked into the Docker image with COPY, unlike `astro dev start` which bind-mounts all four directories via docker-compose. Switch to `-v` bind mounts on `docker create` for dags/, tests/, plugins/, and include/ so that host files are always visible without needing COPY in the Dockerfile. The `.astro/` folder continues to use `docker cp` due to inconsistent `.dockerignore` behavior across platforms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request Test Coverage Report for Build dea3aa0c-6b80-4ca8-93a6-f32c1809e835Details
💛 - Coveralls |
jeremybeard
approved these changes
Feb 19, 2026
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.
Summary
astro dev pytestnow bind-mountsdags/,tests/,plugins/, andinclude/from the host into the ephemeral pytest container, matching the volume mounts thatastro dev startprovides via docker-composedocker cpapproach fordags/(replaced by bind mount) and the post-exitdocker cpofinclude/back to host (now automatic via bind mount).astro/continues to usedocker cpdue to inconsistent.dockerignorebehavior across platformsProblem
astro dev startbind-mountsdags/,tests/,plugins/, andinclude/via docker-compose volumes. However,astro dev pytestcreated a one-off container usingdocker createand only copieddags/and.astro/viadocker cp. This meant:tests/was not available in the pytest container unless baked into the image withCOPY tests ./testsplugins/andinclude/were also missingCOPYdirectives in their Dockerfile solely forastro dev pytest, causing unnecessary image rebuilds and inconsistency with theastro dev startworkflowTraced to
airflow/docker_image.goPytest()function — thedocker createcall had no-vflags, and onlydags/and.astro/were copied post-creation.Fix
Add
-vbind mount flags to thedocker createcall for all four directories (dags/,tests/,plugins/,include/), matching the compose template mounts. This eliminates the need fordocker cpofdags/and ensures all host directories are visible to pytest.Test plan
go test ./airflow/ -run TestDockerImagePytest)go test ./airflow/)tests/found via bind mount-i <custom-image>with host-only file (customer's exact repro) — previously broken, now worksinclude/from inside container persists on host--args,--envflags work.astro/test_dag_integrity_default.pyworks🤖 Generated with Claude Code