|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Issues |
| 4 | + |
| 5 | +Please [read these guidelines](http://ibm.biz/cdt-issue-guide) before opening an issue. |
| 6 | +If you still need to open an issue then we ask that you complete the template as |
| 7 | +fully as possible. |
| 8 | + |
| 9 | +## Pull requests |
| 10 | + |
| 11 | +We welcome pull requests, but ask contributors to keep in mind the following: |
| 12 | + |
| 13 | +* Only PRs with the template completed will be accepted |
| 14 | +* We will not accept PRs for user specific functionality |
| 15 | + |
| 16 | +### Developer Certificate of Origin |
| 17 | + |
| 18 | +In order for us to accept pull-requests, the contributor must sign-off a |
| 19 | +[Developer Certificate of Origin (DCO)](DCO1.1.txt). This clarifies the |
| 20 | +intellectual property license granted with any contribution. It is for your |
| 21 | +protection as a Contributor as well as the protection of IBM and its customers; |
| 22 | +it does not change your rights to use your own Contributions for any other purpose. |
| 23 | + |
| 24 | +Please read the agreement and acknowledge it by ticking the appropriate box in the PR |
| 25 | + text, for example: |
| 26 | + |
| 27 | +- [x] Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1 |
| 28 | + |
| 29 | +## General information |
| 30 | + |
| 31 | +Python-Cloudant Client Library is written in Python. |
| 32 | + |
| 33 | +## Requirements |
| 34 | + |
| 35 | +- Python |
| 36 | +- pip |
| 37 | + |
| 38 | +It is recommended to use a [virtual environment](https://virtualenv.pypa.io/en/latest) during development. The |
| 39 | +python-cloudant dependencies can be installed via the `requirements.txt` file using pip. |
| 40 | + |
| 41 | +For example to create a virtualenv and install requirements: |
| 42 | + |
| 43 | +```sh |
| 44 | +virtualenv . |
| 45 | +./bin/activate |
| 46 | +pip install -r requirements.txt |
| 47 | +pip install -r test-requirements.txt |
| 48 | +``` |
| 49 | + |
| 50 | +## Testing |
| 51 | + |
| 52 | +The tests need an Apache CouchDB or Cloudant service to run against. |
| 53 | + |
| 54 | +The tests create databases in your CouchDB instance, these are `db-<uuid4()>`. |
| 55 | +They also create and delete documents in the `_replicator` database. |
| 56 | + |
| 57 | +The tests are run with the `nosetests` runner. In this example the `ADMIN_PARTY` environment variable is used to tell |
| 58 | + the tests not to use any authentication. See below for the full set of variables that can be used. |
| 59 | + |
| 60 | +```sh |
| 61 | +$ ADMIN_PARTY=true nosetests -w ./tests/unit |
| 62 | +``` |
| 63 | + |
| 64 | +There are several environment variables which affect |
| 65 | +test behaviour: |
| 66 | + |
| 67 | +- `RUN_CLOUDANT_TESTS`: set this to run the tests that use Cloudant-specific features. If |
| 68 | + you set this, you must set one of the following combinations of other variables: |
| 69 | + - `DB_URL`, `DB_USER` and `DB_PASSWORD`. |
| 70 | + - `CLOUDANT_ACCOUNT`, `DB_USER` and `DB_PASSWORD`. |
| 71 | + - If you set both `DB_URL` and `CLOUDANT_ACCOUNT`, `DB_URL` is used as the |
| 72 | + URL to make requests to and `CLOUDANT_ACCOUNT` is inserted into the `X-Cloudant-User` |
| 73 | + header. |
| 74 | +- Without `RUN_CLOUDANT_TESTS`, the following environment variables have an effect: |
| 75 | + - Set `DB_URL` to set the root URL of the CouchDB/Cloudant instance. It defaults |
| 76 | + to `http://localhost:5984`. |
| 77 | + - Set `ADMIN_PARTY` to `true` to not use any authentication details. |
| 78 | + - Without `ADMIN_PARTY`, set `DB_USER` and `DB_PASSWORD` to use those |
| 79 | + credentials to access the database. |
| 80 | + - Without `ADMIN_PARTY` and `DB_USER`, the tests assume CouchDB is in |
| 81 | + admin party mode, but create a user via `_config` to run tests as. |
| 82 | + This user is deleted at the end of the test run, but beware it'll |
| 83 | + break other applications using the CouchDB instance that rely on |
| 84 | + admin party mode being in effect while the tests are running. |
0 commit comments