Python-Cloudant Client Library is written in Python.
In order for us to accept pull-requests, the contributor must sign-off a Developer Certificate of Origin (DCO). This clarifies the intellectual property license granted with any contribution. It is for your protection as a Contributor as well as the protection of IBM and its customers; it does not change your rights to use your own Contributions for any other purpose.
Please read the agreement and acknowledge it by ticking the appropriate box in the PR text, for example:
- [x] Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
Clone the repo into a folder, set up a virtual environment, install the requirements:
$ git clone git clone [email protected]:cloudant/python-cloudant.git
$ cd python-cloudant
$ virtualenv .
$ ./bin/activate
$ pip install -r requirements.txt
$ pip install -r test-requirements.txt
Before running the tests, start CouchDB:
$ couchdb
The tests create databases in your CouchDB instance, these are db-<uuid4()>. They also create and delete documents in the _replicator database.
Now, run the tests. Here, I use the ADMIN_PARTY
environment variable to
tell the tests not to use any authentication. See below for the full set of
variables that can be used.
$ ADMIN_PARTY=true nosetests -w ./tests/unit
There are several environment variables which affect test behaviour:
RUN_CLOUDANT_TESTS
: set this to run the tests that use Cloudant-specific features. If you set this, you must set one of the following combinations of other variables:DB_URL
,DB_USER
andDB_PASSWORD
.CLOUDANT_ACCOUNT
,DB_USER
andDB_PASSWORD
.- If you set both
DB_URL
andCLOUDANT_ACCOUNT
,DB_URL
is used as the URL to make requests to andCLOUDANT_ACCOUNT
is inserted into theX-Cloudant-User
header.
- Without
RUN_CLOUDANT_TESTS
, the following environment variables have an effect: - Set
DB_URL
to set the root URL of the CouchDB/Cloudant instance. It defaults tohttp://localhost:5984
. - Set
ADMIN_PARTY
totrue
to not use any authentication details. - Without
ADMIN_PARTY
, setDB_USER
andDB_PASSWORD
to use those credentials to access the database. - Without
ADMIN_PARTY
andDB_USER
, the tests assume CouchDB is in admin party mode, but create a user via_config
to run tests as. This user is deleted at the end of the test run, but beware it'll break other applications using the CouchDB instance that rely on admin party mode being in effect while the tests are running.
- Set
- Without