From 03ad413f4a7effc93c3d4603cdc3fda9d392d611 Mon Sep 17 00:00:00 2001 From: Benjamin Rosemann Date: Tue, 10 Nov 2020 12:56:08 +0100 Subject: [PATCH] Added some helpful tools and configurations --- .coveragerc | 2 ++ README-DEV.md | 37 ++++++++++++++++++++++++++++++++----- requirements-dev.txt | 4 ++++ setup.cfg | 12 +++++++++++- setup.py | 4 ++++ 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 .coveragerc create mode 100644 requirements-dev.txt diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..5398e23 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = qurator/dinglehopper/tests/* diff --git a/README-DEV.md b/README-DEV.md index ba35796..2f16df7 100644 --- a/README-DEV.md +++ b/README-DEV.md @@ -1,10 +1,37 @@ -Testing -------- +# Testing + Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests): -~~~ +```bash virtualenv -p /usr/bin/python3 venv . venv/bin/activate pip install -r requirements.txt -pip install pytest +pip install -r requirements-dev.txt pytest -~~~ +``` + +### Test running examples +### Only unit tests +```bash +pytest -m "not integration" +``` + +### Only integration tests +```bash +pytest -m integration +``` + +### All tests +```bash +pytest +``` + +### All tests with code coverage +```bash +pytest --cov=qurator --cov-report=html +``` + +### Static code analysis +```bash +pytest -k "not test" --flake8 +pytest -k "not test" --mypy +``` diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..05d682e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +pytest +pytest-flake8 +pytest-cov +pytest-mypy diff --git a/setup.cfg b/setup.cfg index 43d7a3a..aeec880 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,12 @@ [flake8] -max-line-length = 90 +max-line-length = 88 +extend-ignore = E203, W503 + +[pylint] +max-line-length = 88 + +[pylint.messages_control] +disable = C0330, C0326 + +[mypy] +ignore_missing_imports = True diff --git a/setup.py b/setup.py index 56ae184..1551c2d 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,9 @@ from setuptools import find_packages, setup with open("requirements.txt") as fp: install_requires = fp.read() +with open('requirements-dev.txt') as fp: + tests_require = fp.read() + setup( name="dinglehopper", author="Mike Gerber, The QURATOR SPK Team", @@ -16,6 +19,7 @@ setup( namespace_packages=["qurator"], packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), install_requires=install_requires, + tests_require=tests_require, package_data={ "": ["*.json", "templates/*"], },