The following will run on OSX, Linux, and Windows. There is a Unix style Makefile
, as well as make.bat
for Windows users.
pip install sphinx
# generate RST docs
sphinx-apidoc -f -o docs/source e3db
# remove missing environment variable errors
export REGISTRATION_TOKEN=FOO
export DEFAULT_API_URL=FOO
# generate html docs from RST ones
make html
The e3db-python SDK uses flake8 for style enforcement against the pep8 standard, as well as programming standards. Flake8 configuration is stored in .flake8
pip install flake8
flake8 e3db/
Tests for the e3db-python SDK use pytest. This can be installed by running the following:
pip install pytest pytest-cov responses
We need to set a few environment variables that the integration tests require.
The tests will dynamically generate a few clients, and use the server specified
in DEFAULT_API_URL
.
export REGISTRATION_TOKEN=<TOKEN>
export DEFAULT_API_URL=<https://api.url>
pytest --cov-report term-missing --cov -v e3db
This will pattern match names of tests that contain the pattern provided.
pytest -k <pattern>
To test against a locally running instance of E3db checkout the development testing branch development/testing
, make sure it is up-to-date with master, and set these flags with valid values:
export LOCAL_API_URL=http://localhost
export USE_LOCAL_REGISTER=true
export LOCAL_BOOT_KEY=
export LOCAL_BOOT_SECRET=
WARNING #1: Locally, tests with client2 large files do not function, and so this flow should only be used to run specific tests of search not the entire suite.
WARNING #2: Also, when running locally, if you have an existing e3db client config stored at ~/.tozny/e3db.json
, the config read write test will also fail. To test this functionality locally you will need to delete your config before running the test, or use the instructions below to build and run a docker container for idempotent test execution
docker build -t tozny/e3db-python .
This container was built in the previous step, and will have the current code base in the repo running inside it. It is currently necessary to re-build the docker container for code changes due to the python setuptools
configuration. This typically takes 2 to 3 minutes. After the above build step, you can run the container with the following command:
docker run -it --rm --entrypoint=sh -e REGISTRATION_TOKEN=<TOKEN> -e DEFAULT_API_URL=<URL> tozny/e3db-python