From 47923b00c1175aae49b69a5b96e5539dea2646b6 Mon Sep 17 00:00:00 2001 From: Phil Steinke Date: Fri, 4 Sep 2020 16:23:57 +0800 Subject: [PATCH] chore: Add Ansible, molecule and pytest-bdd What: - Add ansible - Add molecule - Add pytest-bdd - to requirements/local.txt ansible==2.9.12 # https://github.com/ansible/ansible pytest-bdd==3.4.0 # https://github.com/pytest-dev/pytest-bdd molecule==3.0.8 # https://github.com/ansible-community/molecule Why: - To run migrations with Ansible - To test Ansible with molecule - To write BDD (Behaviour Driven Development) and TDD - To Add BDD to codebuddies backend - A separate PR to be available to multiple tickets --- README.md | 15 ++++++++++++++- project/requirements/local.txt | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1097370..08808d9b 100644 --- a/README.md +++ b/README.md @@ -130,10 +130,16 @@ $ docker-compose down ### Automated Tests -- We use [pytest](https://docs.pytest.org/en/latest/contents.html) with the [pytest-django](https://pytest-django.readthedocs.io/en/latest/) plugin for running tests. +![Test](https://github.com/codebuddies/django-concept/workflows/Test/badge.svg) +[![codecov](https://codecov.io/gh/codebuddies/backend/branch/master/graph/badge.svg)](https://codecov.io/gh/codebuddies/backend) +See those numbers there? We want to ensure the tests are always passing, and that we have 100% code coverage. + +- We use [pytest](https://docs.pytest.org/en/latest/contents.html) with the [pytest-django] plugin for running tests. - Please add tests for your code when contributing. - Run the test suite using `docker-compose run --rm app pytest` - With test coverage report `docker-compose run --rm app pytest --cov-report=term --cov=.` +- Tests have been extended with [pytest-bdd] and [pytest-sugar] +- Ansible is tested with [molecule] ### Debugging with Docker Logs @@ -297,3 +303,10 @@ Please see [How to contribute here] [CodeBuddies V3 Back-end]: https://github.com/codebuddies/backend [Codebuddies V3 Front-end]: https://github.com/codebuddies/frontend + +[pytest]: https://github.com/pytest-dev/pytest +[pytest-bdd]: https://github.com/pytest-dev/pytest-bdd +[pytest-cov]: https://github.com/pytest-dev/pytest-cov +[pytest-django]: https://pytest-django.readthedocs.io/en/latest/ +[pytest-sugar]: https://github.com/Frozenball/pytest-sugar +[molecule]: https://github.com/ansible-community/molecule diff --git a/project/requirements/local.txt b/project/requirements/local.txt index 7cde2c0c..c975ba85 100644 --- a/project/requirements/local.txt +++ b/project/requirements/local.txt @@ -4,6 +4,7 @@ Werkzeug==0.14.1 # pyup: < 0.15 # https://github.com/pallets/werkzeug ipdb==0.12.2 # https://github.com/gotcha/ipdb Sphinx==2.2.0 # https://github.com/sphinx-doc/sphinx psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2 +ansible==2.9.12 # https://github.com/ansible/ansible # Testing # ------------------------------------------------------------------------------ @@ -11,6 +12,8 @@ mypy==0.720 # https://github.com/python/mypy pytest==5.1.1 # https://github.com/pytest-dev/pytest pytest-cov==2.8.1 # https://github.com/pytest-dev/pytest-cov pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar +pytest-bdd==3.4.0 # https://github.com/pytest-dev/pytest-bdd +molecule==3.0.8 # https://github.com/ansible-community/molecule # Code quality # ------------------------------------------------------------------------------