Our stack consists of:
- Django
- Postgres Docker
- Unit tests with unittest
- Bitbucket Pipelines for CI
- Bitbucket Pipelines for CD [In Progress]
It is recommended that you make a virtual env for the dependencies, to not pollute your system wide dependencies.
pip install -r requirements.txt
pip install -r ci-requirements.txt
pip install -r dev-requirements.txt
Assuming you've set up the python virtual env correctly, you should now have pre-commit
in your path
Run the command in the root git directory
pre-commit install
Run the following command to copy the example environment
cp .env.example .env
Firstly ensure you have docker-compose installed on your system Then run:
cd ./docker
docker-compose up
python -Wa manage.py test
Note that the -Wa flag tells Python to display deprecation warnings for postgres etc.
Make sure to run tests before each pull request. This is the responsibility of the person logging the PR, however reviewers should double check with the logger.
All unit tests should be created inside ./src/tests/*
.
Test discovery is based on the unittest
module’s built-in test discovery. By default, this will discover tests in any file named "test*.py" under the current working directory.
See the Django docs for more information on writing test cases.