Developed by Stefan Kasberger.
Features
- Tests written in pytest and executed with Travis CI. Test coverage by coverage and python-coveralls, viewable on coveralls.io.
- auto-generated documentation through functions and class documentation with sphinx.
Copyright
This instructions are to setup the development environment, which is also the default environment.
Prerequisites
Initialize database
Upgrade database
Config
Download App
Get the app on your computer, into your webservers directory (e. g. vhost).
Install requirements
Start the virtual environment to install the needed python packages.
pip install -r requirements.txt
Set environment variables
Run
Run the flask app:
Install
cd /PATH/TO/VHOST
git clone https://github.com/skasberger/owat_api.git
cd owat_api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements/development.txt
pre-commit install
After changing your SQLAlchemy models, you have to update your database. To add information about your changes, exchange "COMMENT" with your commit message.
flask db migrate -m "COMMENT"
flask db upgrade
To execute the tests, set the application mode and unset database URI.
tox
To execute the tests with tox (as recommended), simply type:
tox
You can find out more about the tox configuration inside tox.ini
and in its documentation.
Coverage
To get test coverage of codebase, use coverage.
coverage run main.py
coverage report -m
coverage html
Run tests with coverage to create a html report as an output.
pytest --cov-report html --cov=app tests/
Coveralls
To use Coveralls on local development:
pytest tests/ --doctest-modules -v --cov=app
And to use Coveralls on Travis-CI
pytest tests/ --doctest-modules -v --cov coveralls --cov-report term-missing
Use Sphinx to create class and function documentation out of the doc-strings.
tox -e docs