Testing

Setting Up a Testing Environment

  1. Install the testing Dependencies
$ pip3 install -r requirements-dev.txt
  1. Run the tests
In the pyTD root directory, there is a shell script test.sh. This script first verifies flake8 compliance, then runs all tests with pytest.

Writing Tests

Marking

All tests which require HTTP requests which are not mocked should be marked with pytest.mark.webtest. These tests will be automatically skipped if pyTD has not been properly configured or does not have a valid access token (this is verified through pyTD.api.default_auth_ok).

Fixtures

A number of fixtures are used to provide instantiated objects (api, tokens, etc.) as well as parametrize tests. These fixtures can be found in the fixtures directory.