14👍
✅
Haven’t thoroughly tested it, but I believe something like this should work:
[tox]
envlist = py{36,37,38}-django{22,30}
isolated_build = True
[testenv]
deps =
django22: Django==2.2
django30: Django==3.0
# plus the dev dependencies
pytest
coverage
commands =
pytest --cov=my_app tests/
coverage report -m
See the "poetry" section in the "packaging" chapter of the tox documentation.
In order to avoid the repetition of the dev dependencies, one could try the following variation based on the extras feature:
tox.ini
[tox]
# ...
[testenv]
# ...
deps =
django22: Django==2.2
django30: Django==3.0
extras =
test
pyproject.toml
[tool.poetry]
# ...
[tool.poetry.dependencies]
python = "^3.6"
django = "^2.2 || ^3.0"
#
pytest = { version = "^5.2", optional = true }
[tool.poetry.extras]
test = ["pytest"]
[build-system]
# ...
Nowadays there are tox plug-ins that try to make for a better integration with poetry-based projects:
tox-poetry-installer
tox-poetry-dev-dependencies
(disclaimer: my project)tox-poetry
Source:stackexchange.com