-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(tests): Add badges reflecting code quality + README.md dedicated …
…to tests
- Loading branch information
1 parent
a88fa53
commit f19e78a
Showing
11 changed files
with
109 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
appdaemon/compiled/* | ||
**/__pycache__/* | ||
**/.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Appdaemon application tests | ||
|
||
***X@v*** : Can you explain me why tests are important in computer programming in 2 sentences? | ||
|
||
***ChatGPT***: Tests are crucial in computer programming as they help ensure the correctness and reliability of code by systematically verifying that it produces the expected outcomes. They also aid in detecting and preventing bugs early in the development process, leading to more maintainable and higher quality software. | ||
|
||
Voilà, this is why I created this directory. | ||
|
||
## Test coverage | ||
|
||
Test coverage measures the extent to which a software's source code is exercised by a set of tests, indicating the proportion of code paths that have been tested. | ||
|
||
For my Appdaemon application I try to cover the maximum of code with tests. | ||
|
||
## Test framework | ||
|
||
The test framework is a structured environment and set of tools that streamline the process of designing, executing, and managing tests, enhancing the efficiency and effectiveness of software testing endeavors. | ||
|
||
I found on the Internet several test framework for Appdaemon. The one I choose was not the most powerfull but it is easy to understand and easy to upgrade. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
test_dir=$(realpath "$(dirname $0)") | ||
appdaemon_dir=$(realpath "${test_dir}/../") | ||
git_dir=$(realpath "${appdaemon_dir}/../") | ||
apps_dir=$(realpath "${appdaemon_dir}/apps/") | ||
pushd ${appdaemon_dir} > /dev/null | ||
export PYTHONPATH=${apps_dir} | ||
value=$(coverage run --source ${apps_dir} -m pytest | tee /dev/tty | perl -ne '/\[(.*)\]/ and print "$1\n"' | tail -1) | ||
anybadge -l "pytest success" -v ${value} -o -f ../images/pytest.svg 70=red 80=orange 90=yellow 100=green | ||
value=$(coverage report -m |& tee /dev/tty | perl -ne '/TOTAL.* (\S+%)/ and print "$1"') | ||
anybadge -l coverage -v ${value} -o -f ../images/coverage.svg 70=red 80=orange 90=yellow 100=green | ||
coverage html | ||
echo ${test_dir}/htmlcov/index.html | ||
value=$(pylint $(git ls-files '*.py' | grep -v notifier.py | grep -v hass_driver.py) --rcfile ${git_dir}/.pylintrc | tee /dev/tty | perl -ne '/at (\S+)/ and print "$1"') | ||
anybadge -l pylint -v "${value}" -o -f ../images/pylint.svg 70=red 80=orange 90=yellow 100=green | ||
popd > /dev/null |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
anybadge==1.14.0 | ||
appdaemon==4.4.2 | ||
coverage==7.2.7 | ||
esphome==2023.8.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.