Skip to content

Commit

Permalink
Merge pull request numerique-gouv#51 from yaal-coop/issue-42-tox
Browse files Browse the repository at this point in the history
Exécution des tests unitaires sur différentes versions de python avec tox
  • Loading branch information
azmeuk authored Dec 8, 2023
2 parents 95dc738 + 465948a commit 40cd305
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ ou bien dans l'environnement Poetry avec pytest (dont certains settings sont dan
pytest
```

Pour tester le code sur les différentes versions de python en cours, et prévenir des incompatibilités avec des versions futures, utilisez :
```bash
tox
```

#### Conventions de code

Le code python doit suivre les conventions de la PEP 8. Dans les dépendance de développement du projet, on retrouve `flake8` et `black`.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

install-dev:
# Install dependencies for local development usage
poetry env use 3.8 ; poetry install --with dev ; poetry shell
poetry install --with dev ; poetry shell
pre-commit install

export-base-dependencies:
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,35 @@ ignore = [
"E722", # bare expect
"E402", # import not at the top of the file
]

[tool.tox]
legacy_tox_ini = """
[tox]
isolated_build = true
skipsdist = true
envlist =
style
py38
py39
py310
py311
py312
coverage
[testenv]
allowlist_externals = poetry
commands =
poetry install
poetry run pytest {posargs}
[testenv:style]
commands =
pip install pre-commit
pre-commit run --all-files
[testenv:coverage]
commands =
poetry install
poetry run pytest --cov --cov-report term:skip-covered {posargs}
poetry run coverage html
"""
2 changes: 1 addition & 1 deletion web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-bullseye
FROM python:3.11-bullseye

# Install.
RUN \
Expand Down
2 changes: 1 addition & 1 deletion web/Dockerfile-celery
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-bullseye
FROM python:3.11-bullseye

# Install.
RUN \
Expand Down
2 changes: 1 addition & 1 deletion web/Dockerfile-tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-bullseye
FROM python:3.11-bullseye

# Install.
RUN \
Expand Down

0 comments on commit 40cd305

Please sign in to comment.