Skip to content

Testing

Rose Pearson edited this page Aug 3, 2021 · 3 revisions

Tests exist for each module (i.e. fetch lidar).

Automated testing

Github Actions are used to run tests after each push to remote (i.e. github). Minicondafrom the GitHub Actions marketplace is used to install the package dependencies. Linting with Flake8 and testing with PyTest is then performed. Several tests require an API key. This is stored as a GitHub secret and accessed by the workflow.

See Package Requirements for details about the required API tokens. This blog was used to create the secret string directly from an .env file, and to set the GitHub Actions workflow to create a local instance of the .env file for each workflow run.

Check the actions tab after you push to check if your tests run successfully.

Running tests locally

Several tests (test_vector_fetch, and test_processor_remote_all_westport) require a LINZ API token. Create an API token using the instructions under the Requirements section then store it in an .env file under root.

LINZ_API="COPY_YOUR_API_KEY_HERE"

In the conda environment defined in the root\environment_[windows|linux].yml, run the following in the repository root folder:

to run individual tests call python -m tests.test_processor_local_files.test_processor_local_files or python -m tests.test_lidar_fetch.test_lidar_fetch etc. to run all tests call python -m unittest

Clone this wiki locally