This document is for pytest_celery's development version, which can be significantly different from previous releases. Get the stable docs here: 1.0.
Local Development Environment¶
- Release:
1.1
- Date:
Sep 30, 2024
Cloning the Repository¶
Clone the repository from GitHub: https://github.com/celery/pytest-celery
Https:
https://github.com/celery/pytest-celery.git
SSH:
git@github.com:celery/pytest-celery.git
GitHub CLI:
gh repo clone celery/pytest-celery
Using Poetry¶
The plugin uses Poetry for dependency management.
To install the development dependencies, run the following command in your desired virtual environment:
poetry install -E "all" --with test,dev,ci,docs
Tip
During development of the dependencies themselves, you can use the following snippet for easy cleanup & reinstallation of the dependencies:
pip uninstall pytest-celery celery -y && pip freeze | cut -d "@" -f1 | xargs pip uninstall -y;\
pip install -U pip ipython;\
poetry install -E "all" --with test,dev,ci,docs
Debugging with VSCode¶
Create a .vscode
directory with the following launch.json
file that can be used to for debugging.
Note
Take note of "justMyCode": false
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": [
"debug-test",
],
"console": "integratedTerminal",
"justMyCode": false,
"presentation": {
"hidden": true
},
// Disable cov to allow breakpoints when launched from VS Code Python
"env": {
"PYTHONUNBUFFERED": "1",
"PYTHONDONTWRITEBYTECODE": "1",
"PYTEST_ADDOPTS": "--no-cov --exitfirst"
},
"stopOnEntry": false,
"showReturnValue": true,
"redirectOutput": true
},
{
"name": "Attach to Celery Worker",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "path-to-celery-source-in-container"
}
]
}
]
}