forked from FlorianRhiem/mogli
-
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.
Added tests and code style checks for use in Jenkins.
- Loading branch information
1 parent
aaaf629
commit 6412b82
Showing
11 changed files
with
642 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
export PYTHONPATH=`pwd`:$PYTHONPATH | ||
|
||
# Set up virtual environment | ||
[ ! -e env ] || rm -rf env | ||
virtualenv --python=python2.7 env | ||
. env/bin/activate | ||
# Install testing packages | ||
pip install pep8 pylint pytest pytest-cov | ||
|
||
# Install requirements | ||
pip install numpy gr glfw PyOpenGL | ||
|
||
|
||
# PEP8 conformance check (will cause build failure if python files are not PEP8 conformant) | ||
pep8 $(find . -path ./env -prune -o -name "*.py" -print) | tee pep8.log | ||
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then | ||
echo "Failed PEP8 conformance check!"; | ||
exit 1; | ||
fi | ||
|
||
|
||
# PyLint code style check (will NOT cause build failure as pylint tends to overreact) | ||
if [[ ! -f pylintrc ]]; then | ||
echo "pylintrc missing!"; | ||
exit 1; | ||
fi | ||
pylint --rcfile=pylintrc "--msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" $(find . -path ./env -prune -o -path ./tests -prune -o -name "*.py" -print) | tee pylint.log | ||
|
||
|
||
# Run py.test (will cause build failure if a test fails) | ||
if [[ ! -f pytest.ini ]]; then | ||
echo "pytest.ini missing!"; | ||
exit 1; | ||
fi | ||
if [[ ! -f coveragerc ]]; then | ||
echo "coveragerc missing!"; | ||
exit 1; | ||
fi | ||
py.test --cov-config coveragerc --cov-report html --cov . | tee py.test.log | ||
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then | ||
echo "Failed tests!"; | ||
exit 1; | ||
fi | ||
|
||
|
||
# Report build success | ||
exit 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[run] | ||
omit = env/*, setup.py, examples/* | ||
branch = True |
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
Oops, something went wrong.