diff options
author | Tim Hall <tim.hall@arm.com> | 2020-05-26 09:18:53 +0100 |
---|---|---|
committer | Tim Hall <tim.hall@arm.com> | 2020-06-18 17:53:52 +0100 |
commit | f1b67deadf80db5c7c65d5a31737e57047fff533 (patch) | |
tree | 5eb869300b1cc68b0cb6bdee27cb9a6c3063d452 /TESTING.md | |
parent | 93dc553d206e795250e420676e4c46dd9269ad82 (diff) | |
download | ethos-u-vela-f1b67deadf80db5c7c65d5a31737e57047fff533.tar.gz |
MLBEDSW-2063: Add contributions guidelines
- Create new CONTRIBUTIONS.md
- Rearrange README.md to reference new documentation
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: I502b1606a3fe829a9e242a5de7391bf769203b8c
Diffstat (limited to 'TESTING.md')
-rw-r--r-- | TESTING.md | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 00000000..371ece1f --- /dev/null +++ b/TESTING.md @@ -0,0 +1,71 @@ +# Vela Testing + +## Sanity checks and tests + +The Python codebase is PEP8 compliant with the exception of a 120 character 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. Those tools are run using +[pre-commit framework](https://pre-commit.com/). The configuration file is +.pre-commit-config.yaml + +### Install tools + +To install pre-commit, run the following: + +```bash +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 + +To ease the development, we can run those sanity checks before committing the +code. To install the git hook, run: + +```bash +$ pre-commit install +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. + +```bash +$ pre-commit run pytest +... +$ pre-commit run pytest-cov +``` + +### Run the sanity checks + +Those checks can be run manually. This can be achieved running the following + +```bash +$ pre-commit run reorder-python-imports --all-files +... +$ pre-commit run flake8 --all-files +... +$ pre-commit run black --all-files +``` + +If you don't specify anything after run, it will execute all the checks. + +```bash +$ pre-commit run --all-files +Reorder python imports...................................................Passed +black....................................................................Passed +flake8...................................................................Passed +pytest...................................................................Passed +... +... +``` |