|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Test Coverage |
| 4 | + |
| 5 | +To contribute to Consulate, please make sure that any new features or changes |
| 6 | +to existing functionality **include test coverage**. |
| 7 | + |
| 8 | +*Pull requests that add or change code without coverage have a much lower chance |
| 9 | +of being accepted.* |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +Consulate test suite has a couple of requirements: |
| 14 | + |
| 15 | + * Dependencies from [requirements/testing.txt](requirements/testing.txt) are installed |
| 16 | + * Local Docker and [docker-compose](https://docs.docker.com/compose/) |
| 17 | + |
| 18 | +## Installing Dependencies |
| 19 | + |
| 20 | +You may want to develop in a virtual environment. This is usually done inside the source |
| 21 | +repository, and `.gitignore` is configured to ignore a virtual environment in `env`. |
| 22 | + |
| 23 | +```bash |
| 24 | +python3 -m venv env |
| 25 | +source env/bin/activate |
| 26 | +``` |
| 27 | + |
| 28 | +To install the dependencies needed to run Consulate tests, use |
| 29 | + |
| 30 | +```bash |
| 31 | +pip install -r requirements/testing.txt |
| 32 | +``` |
| 33 | + |
| 34 | +## Starting the test dependency |
| 35 | + |
| 36 | +Prior to running tests, ensure that Consul is running via Docker using: |
| 37 | + |
| 38 | +```bash |
| 39 | +./bootstrap |
| 40 | +``` |
| 41 | + |
| 42 | +This script uses [docker-compose](https://docs.docker.com/compose/) to launch a Consul server container that is |
| 43 | +pre-configured for the tests. In addition, it configures `build/test-environment` that is loaded |
| 44 | +by the tests with configuration information for connecting to Consul. |
| 45 | + |
| 46 | +## Running Tests |
| 47 | + |
| 48 | +To run all test suites, run: |
| 49 | + |
| 50 | + nosetests |
| 51 | + |
| 52 | +## Code Formatting |
| 53 | + |
| 54 | +Please format your code using [yapf](http://pypi.python.org/pypi/yapf) |
| 55 | +with ``pep8`` style prior to issuing your pull request. In addition, run |
| 56 | +``flake8`` to look for any style errors prior to submitting your PR. |
| 57 | + |
| 58 | +Both are included when the test requirements are installed. If you are fixing |
| 59 | +formatting for existing code, please separate code-reformatting commits from |
| 60 | +functionality changes. |
0 commit comments