Skip to content

Commit

Permalink
Use poetry in tox again
Browse files Browse the repository at this point in the history
tox.ini:
Call poetry in tox.ini again, as this way we can ensure to install
all packages based on the lock file.
Additionally, this allows to properly and selectively install extras,
required e.g. by the coverage target (as to not install pyalpm for all
targets).

.gitlab-ci.yml:
Install python-poetry to test environment.

pyproject.toml:
Add setuptools to build requirements because of bug in pip:
pypa/pip#6100
  • Loading branch information
dvzrv committed Jun 14, 2022
1 parent fcdf8ad commit e224723
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stages:
before_script:
- printf "[multilib]\nInclude = /etc/pacman.d/mirrorlist\n" >> /etc/pacman.conf
- pacman --noconfirm -Fyy
- pacman --noconfirm -Syyu --needed base-devel git python-tox
- pacman --noconfirm -Syyu --needed base-devel git python-poetry python-tox

linter:
extends: .test
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,7 @@ disallow_incomplete_defs = true
show_error_codes = true

[build-system]
requires = ["poetry-core>=1.0.0"]
# requiring setuptools to get around flaky pip behavior (we actually don't need it)
# https://github.com/pypa/pip/issues/6100
requires = ["setuptools", "poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
36 changes: 19 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
[tox]
isolated_build = true
isolated_build = True
envlist = linter,coverage
skip_missing_interpreters = True
requires =
tox-poetry-dev-dependencies

[testenv]
base_python = py310
poetry_add_dev_dependencies = True
whitelist_externals = poetry

[testenv:coverage]
commands =
coverage run
coverage xml -o {toxworkdir}/coverage.xml -i
coverage html -d {toxworkdir}/htmlcov -i
coverage report --fail-under=100.0
poetry install -E vercmp
poetry run coverage run
poetry run coverage xml -o {toxworkdir}/coverage.xml -i
poetry run coverage html -d {toxworkdir}/htmlcov -i
poetry run coverage report --fail-under=100.0

[testenv:linter]
commands =
isort --check .
black --check .
flake8
mypy --install-types --non-interactive -p repod -p tests
poetry install
poetry run isort --check .
poetry run black --check .
poetry run flake8
poetry run mypy --install-types --non-interactive -p repod -p tests

[testenv:docs]
commands =
python -c 'from repod.models.package import export_schemas; export_schemas(output="docs/repositories/schema/")'
python -c 'from repod.files.buildinfo import export_schemas; export_schemas(output="docs/packages/schema/")'
python -c 'from repod.files.mtree import export_schemas; export_schemas(output="docs/packages/schema/")'
sphinx-build -M html docs/ docs/_build/
poetry install
poetry run python -c 'from repod.models.package import export_schemas; export_schemas(output="docs/repositories/schema/")'
poetry run python -c 'from repod.files.buildinfo import export_schemas; export_schemas(output="docs/packages/schema/")'
poetry run python -c 'from repod.files.mtree import export_schemas; export_schemas(output="docs/packages/schema/")'
poetry run sphinx-build -M html docs/ docs/_build/

[testenv:integration]
commands =
pytest -vv tests/ -m "integration"
poetry install
poetry run pytest -m "integration"

0 comments on commit e224723

Please sign in to comment.