IntelliJ IDEA 2021.1 Help

Tox Support

IntelliJ IDEA integrates with tox and allows running tests in multiple environments.

Configure tox

  1. Ensure that Python is downloaded and installed on your machine.

  2. Download tox.

  3. Create a Python project.

  4. Ensure that at least one Python SDK is configured.

  5. Install tox for the Python SDK.

  6. Ensure that your project has the following files:

    • tox.ini

    • setup.py

    • test files

Execute tox tests

  1. Record the test requirements in the tox.ini file.

    Example:

    [tox] envlist = py37,py38 [testenv] deps = pytest commands = pytest

    See https://pypi.org/project/tox/ for more details.

  2. Right-click the file tox.ini and choose Run. The dedicated tox run/debug configuration is launched.

    The results show up in the test runner tab of the Run tool window:

    Running tox tests
  3. Right-click any test result in the Test Runner to execute tox in a particular environment:

    Context menu to  run a tox test

The test tree view shows only for those runners that IntelliJ IDEA is aware of. If IntelliJ IDEA doesn't understand the test runner, then the interpreter name only is written.

Last modified: 08 March 2021