.. _testing: Testing ======= .. _testing.environment: Setting Up a Testing Environment -------------------------------- 1. Install the testing :ref:`dependencies` .. code:: bash $ pip3 install -r requirements-dev.txt 2. 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. .. _testing.writing-tests: 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. .. seealso:: `pytest Fixtures Documentation `__ .. _testing.dependencies: Testing Dependencies -------------------- Tests ~~~~~ - `pytest `__ - `tox `__ - `flake8 `__ Documentation ~~~~~~~~~~~~~ - `sphinx `__ - `sphinx-autobuild `__ - `sphinx-rtd-theme `__ - `ipython `__ - `matplotlib `__