Skip to content

Make pytest-celery package install configurable in worker Dockerfile#475

Merged
auvipy merged 2 commits intocelery:mainfrom
Nusnus:sqs-revert-hotfix-dockerfile-improvement
Mar 2, 2026
Merged

Make pytest-celery package install configurable in worker Dockerfile#475
auvipy merged 2 commits intocelery:mainfrom
Nusnus:sqs-revert-hotfix-dockerfile-improvement

Conversation

@Nusnus
Copy link
Copy Markdown
Member

@Nusnus Nusnus commented Mar 2, 2026

Added PYTEST_CELERY_PKG build arg to the worker Dockerfile, defaulting to 'pytest-celery' (PyPI). This allows CI and users to override the install source, e.g. to install from a specific branch:

PYTEST_CELERY_PKG='pytest-celery@git+https://github.com/celery/pytest-celery.git@my-branch'

  • Added PYTEST_CELERY_PKG ARG to Dockerfile (default: pytest-celery)
  • Added DEFAULT_WORKER_PYTEST_CELERY_PKG constant
  • Added pytest_celery_pkg() classmethod to CeleryWorkerContainer
  • Added default_worker_pytest_celery_pkg fixture
  • Wired into buildargs() and celery_base_worker_image build fixture

@Nusnus Nusnus self-assigned this Mar 2, 2026
@auvipy auvipy requested review from auvipy and Copilot March 2, 2026 14:46
@Nusnus Nusnus force-pushed the sqs-revert-hotfix-dockerfile-improvement branch from 0353e52 to 130da97 Compare March 2, 2026 14:47
@auvipy auvipy review requested due to automatic review settings March 2, 2026 14:48
Added PYTEST_CELERY_PKG build arg to the worker Dockerfile, defaulting
to 'pytest-celery' (PyPI). This allows CI and users to override the
install source, e.g. to install from a specific branch:

  PYTEST_CELERY_PKG='pytest-celery@git+https://github.com/celery/pytest-celery.git@my-branch'

- Added PYTEST_CELERY_PKG ARG to Dockerfile (default: pytest-celery)
- Added DEFAULT_WORKER_PYTEST_CELERY_PKG constant
- Added pytest_celery_pkg() classmethod to CeleryWorkerContainer
- Added default_worker_pytest_celery_pkg fixture
- Wired into buildargs() and celery_base_worker_image build fixture
@Nusnus Nusnus force-pushed the sqs-revert-hotfix-dockerfile-improvement branch from 130da97 to f8e8218 Compare March 2, 2026 14:51
@auvipy auvipy requested a review from Copilot March 2, 2026 15:04
Copy link
Copy Markdown
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configurable PYTEST_CELERY_PKG build argument so the built-in worker image can install pytest-celery from PyPI by default or from an alternate source (e.g., a git ref) in CI/custom setups.

Changes:

  • Introduces DEFAULT_WORKER_PYTEST_CELERY_PKG and threads it through CeleryWorkerContainer.buildargs().
  • Adds a session fixture default_worker_pytest_celery_pkg and wires it into the worker image build args.
  • Updates CI workflows to set PYTEST_CELERY_PKG to install pytest-celery from the current repo.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/vendors/test_worker/test_worker.py Updates buildargs unit test to include PYTEST_CELERY_PKG.
src/pytest_celery/vendors/worker/fixtures.py Adds default_worker_pytest_celery_pkg fixture and passes it into celery_base_worker_image build args.
src/pytest_celery/vendors/worker/defaults.py Adds DEFAULT_WORKER_PYTEST_CELERY_PKG defaulting from PYTEST_CELERY_PKG env var.
src/pytest_celery/vendors/worker/container.py Adds pytest_celery_pkg() and includes it in buildargs().
src/pytest_celery/vendors/worker/Dockerfile Adds ARG PYTEST_CELERY_PKG and installs it via pip during image build.
src/pytest_celery/init.py Exposes the new fixture when the worker vendor is installed.
.github/workflows/python-package.yml Sets PYTEST_CELERY_PKG for CI runs.
.github/workflows/examples.yml Sets PYTEST_CELERY_PKG for examples CI runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.71%. Comparing base (c045029) to head (34f0886).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pytest_celery/vendors/worker/container.py 25.00% 3 Missing ⚠️
src/pytest_celery/vendors/worker/fixtures.py 0.00% 3 Missing ⚠️
src/pytest_celery/__init__.py 0.00% 1 Missing ⚠️
src/pytest_celery/vendors/worker/defaults.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #475      +/-   ##
==========================================
- Coverage   23.80%   23.71%   -0.09%     
==========================================
  Files          41       41              
  Lines        1294     1303       +9     
  Branches       78       78              
==========================================
+ Hits          308      309       +1     
- Misses        959      967       +8     
  Partials       27       27              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Quote ${PYTEST_CELERY_PKG} in Dockerfile to prevent shell word-splitting
- Use commit SHA instead of branch name in CI workflows for deterministic builds
@Nusnus Nusnus marked this pull request as ready for review March 2, 2026 15:50
@auvipy auvipy merged commit f00b0c2 into celery:main Mar 2, 2026
46 checks passed
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.

3 participants