Commit 072d7c89 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Create test script to run tests.

The trigger is that pylint doesn't support Python 3.2 anymore, and in
that case Travis CI should not run pylint.

This script takes an optional argument for the executable name of the
corresponding Python version (typically just 'python2' and 'python3').
When not given, 'python' is just run, whatever is in your $PATH. The
latter mode is used in Travis CI.
parent 9ee7c591
...@@ -8,7 +8,7 @@ install: ...@@ -8,7 +8,7 @@ install:
- "pip install ." - "pip install ."
- "pip install icalendar" - "pip install icalendar"
- "pip install pylint" - "pip install pylint"
script: "python setup.py test && pylint --errors-only topydo test" script: "./run-tests.sh"
notifications: notifications:
webhooks: webhooks:
urls: urls:
......
If you're reading this, you may have interest in enhancing topydo. Thank you! If you're reading this, you may have interest in enhancing topydo. Thank you!
Please read the following guidelines to get your enhancement / bug fixes smoothly into topydo: Please read the following guidelines to get your enhancement / bug fixes
smoothly into topydo:
* This Github page defaults to the **stable** branch which is for **bug fixes only**. If you would like to add a new * This Github page defaults to the **stable** branch which is for **bug fixes
feature, make sure to make a Pull Request on the `master` branch. only**. If you would like to add a new feature, make sure to make a Pull
Request on the `master` branch.
* Run tests with: * Run tests with:
python2 setup.py test ./run-tests.sh [python2|python3]
python3 setup.py test
Obviously, I won't accept anything that makes the tests fail. When you submit
Obviously, I won't accept anything that makes the tests fail. When you submit a Pull Request, Travis CI will a Pull Request, Travis CI will automatically run all tests for various Python
automatically run all tests for various Python versions, but it's better if you run the tests locally first. versions, but it's better if you run the tests locally first.
Make sure you have the `mock` package installed if you test on a Python version older than 3.3. Make sure you have the `mock` package installed if you test on a Python
version older than 3.3.
* Add tests for your change(s): * Add tests for your change(s):
* Bugfixes: add a testcase that covers your bugfix, so the bug won't happen ever again. * Bugfixes: add a testcase that covers your bugfix, so the bug won't happen
* Features: add testcases that checks various inputs and outputs of your feature. Be creative in trying to break the ever again.
feature you've just implemented. * Features: add testcases that checks various inputs and outputs of your
feature. Be creative in trying to break the feature you've just implemented.
* Use descriptive commit messages. * Use descriptive commit messages.
### Coding style ### Coding style
* Please try to adhere to the coding style dictated by `pylint` as much possible. I won't be very picky about long lines, * Please try to adhere to the coding style dictated by `pylint` as much
but please try to avoid them. possible. I won't be very picky about long lines, but please try to avoid
* I strongly prefer simple and short functions, doing only one thing. I'll request you to refactor functions with them.
massive indentation or don't fit otherwise on a screen. * I strongly prefer simple and short functions, doing only one thing. I'll
request you to refactor functions with massive indentation or don't fit
otherwise on a screen.
#!/bin/bash
if [ "$1" = "python2" ] || [ "$1" = "python3" ]; then
PYTHON=$1
else
# run whatever is active
PYTHON=python
fi
# Run normal tests
if ! $PYTHON setup.py test; then
exit 1
fi
# pylint is not supported on 3.2, so skip the test there
if $PYTHON --version 2>&1 | grep 'Python 3\.2' > /dev/null; then
exit 0
fi
if ! $PYTHON -m pylint --errors-only topydo test; then
exit 1
fi
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment