Skip to content

fix: copy include/ artifacts back to host after astro dev pytest#2099

Open
tayloramurphy wants to merge 1 commit into
astronomer:mainfrom
tayloramurphy:fix-pytest-artifacts-2066
Open

fix: copy include/ artifacts back to host after astro dev pytest#2099
tayloramurphy wants to merge 1 commit into
astronomer:mainfrom
tayloramurphy:fix-pytest-artifacts-2066

Conversation

@tayloramurphy
Copy link
Copy Markdown
Collaborator

Summary

Implementation notes

  • After the pytest container runs, docker cp astro-pytest:/usr/local/airflow/include/. <airflowHome>/include restores artifact visibility on the host.
  • The reverse copy is skipped when the host has no include/ directory, so docker cp never errors on projects without one.
  • Errors are logged at debug level (same pattern used for the HTML report copy and the final rm) so an unexpected cp failure does not mask the real pytest exit code.

Test plan

  • go test ./airflow/ -run 'TestAirflow/TestDockerImagePytest' -v -count=1 — all existing pytest subtests pass, plus two new ones:
    • copies include/ back to host after test run — asserts the reverse cp targets astro-pytest:/usr/local/airflow/include/.<airflowHome>/include and runs after start.
    • skips reverse include/ copy when host include/ does not exist — asserts no reverse cp is attempted when the host directory is absent.
  • go test ./airflow/ -count=1 — full airflow package passes.
  • Manual verification on a real project: astro dev pytest --args '--junit-xml=include/pytest_report.junit.xml' followed by file include/pytest_report.junit.xml to confirm the artifact is present.

astronomer#2036 replaced the bind mounts in the pytest flow with a forward
`docker cp` loop but never added a reverse copy, so files pytest
writes to include/ (e.g. --junit-xml=include/pytest_report.junit.xml)
stay stranded in the container. The astro-dev-pytest docs explicitly
promise that artifacts in include/ are accessible after the test run.

Copy the contents of include/. back from the container to the host
after pytest finishes, skipping when the host include/ is absent so
docker cp never fails on projects without the directory.

Fixes astronomer#2066
@tayloramurphy tayloramurphy requested a review from a team as a code owner April 22, 2026 22:32
@tayloramurphy tayloramurphy self-assigned this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Artifacts generated during astro dev pytest are not available after tests have finished

1 participant