commit 050e19bd1a4fd0a9f003ee4bb8fcfc91d431d4f8 Author: Benjamin Renard Date: Wed Mar 8 19:50:55 2023 +0100 Initial version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c5f88a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +.*.swp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9ca1572 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +from debian:stable-slim + +RUN apt-get update && apt-get install --no-install-recommends -y python3-all python3-dev python3-pip python3-venv build-essential git && apt-get clean && rm -fr rm -rf /var/lib/apt/lists/* +RUN pip install -U pytest pylint pylint-junit flake8 flake8-junit-report junitparser pyupgrade pyupgrade-directories black black-junit isort diff --git a/README.md b/README.md new file mode 100644 index 0000000..9766028 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Docker image providing common Python test tools + +Image with common dependencies and common Python test tools: + +- common python packages: `python3-all python3-dev python3-pip python3-venv pylint3` +- `build-essential` to allow local python package using `pip` +- `git` +- pip installed version of `pytest`, `flake8`, `pylint`, `pyupgrade` (with `pyupgrade-directories` helper lib), `black` and `isort` +- associated tools to produce JUnit tests result files: `pylint-junit`, `flake8-junit-report` and `black-junit` +- `junitparser` tool to merge JUnit tests result files + +## Usage example: + +```bash +docker run -it -v "$(pwd)":/src -w /src brenard/python-tests +pip install . +pytest --junitxml=pytest.xml tests +pylint --load-plugins=pylint_junit --output-format=junit --output pylint.xml mysoft tests +flake8 --output-file flake8.txt mysoft tests +flake8_junit flake8.txt flake8.xml +black --verbose --target-version py37 --line-length 100 mysoft tests 2>&1 | black-junit > black.xml +junitparser merge pytest.xml pylint.xml flake8.xml black.xml tests-report.xml +pyup_dirs --keep-percent-format --py37-plus mysoft tests +isort --profile black --line-length 100 mysoft tests +```