From c82b40c9fa3d1fc5239632efff1d99aad3b0a61e Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Wed, 22 Apr 2020 16:19:26 +0100 Subject: Add pytest/pytest-cov support for pre-commit Pytest (testing framework) and pytest-cov are now part of the python environment and run automatically by pre-commit hook. Change-Id: If55cae9f29391c80c809a0487785786a7b9ae62a Signed-off-by: Diego Russo --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4c779d56..3df86dc8 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Vela is licensed under [Apache License 2.0](LICENSE.txt) Contributions are accepted under Apache-2.0. Only submit contributions where you have authored all of the code. -### Sanity checks +### Sanity checks and tests The Python codebase is PEP8 compliant with the exception of 120 characters line length. We run reorder-python-import, black and flake8 against the code base excluding "ethosu/vela/tflite/" and "ethosu/vela/ethos\_u55\_regs" directories because they are auto-generated by third party tools. @@ -130,6 +130,9 @@ pipenv install -e . --dev ``` After the installation, pre-commit is available in the virtual environment. +Besides pre-commit, we install also: +* pytest: testing framework +* pytest-cov: code coverage plugin for pytest #### Install the pre-commit hook @@ -143,6 +146,16 @@ pre-commit installed at .git/hooks/pre-commit The checks will be run before the commit: if one of them fails, you need to fix the code to make the checks pass. +#### Run the tests + +Tests and test coverage can be run using pre-commit framework. + +``` +$ pre-commit run pytest +... +$ pre-commit run pytest-cov +``` + #### Run the sanity checks Those checks can be run manually. This can be achievied running the following @@ -160,4 +173,7 @@ $ pre-commit run --all-files Reorder python imports...................................................Passed black....................................................................Passed flake8...................................................................Passed +pytest...................................................................Passed +... +... ``` -- cgit v1.2.1