PyCharm 2024.1 Help

Tox Support

PyCharm integrates with tox and allows running tests in multiple environments.

Configure tox

  1. Create a Python project.

  2. Install tox for the project Python interpreter.

  3. Ensure that your project has the following files:

    • tox.ini

    • test files

Execute tox tests

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

    Example:

    [tox] envlist = py310 py312 [testenv] deps = pytest pytest-bdd commands = pytest

    See the tox documentation 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 PyCharm is aware of. If PyCharm doesn't understand the test runner, then the interpreter name only is written.

Last modified: 05 April 2024