Developers FAQ

This section contains information for users who want to extend the tox source code.

PyCharm

  1. To generate the project interpreter you can use tox -rvvve dev.

  2. For tests we use pytest, therefore change the Default test runner to pytest.

  3. In order to be able to debug tests which create a virtual environment (the ones in test_z_cmdline.py) one needs to disable the PyCharm feature Attach to subprocess automatically while debugging (because virtualenv creation calls via subprocess to the pip executable, and PyCharm rewrites all calls to Python interpreters to attach to its debugger - however, this rewrite for pip makes it to have bad arguments: no such option --port).

Multiple Python versions on Windows

In order to run the unit tests locally all Python versions enlisted in tox.ini need to be installed.

Note

For a nice Windows terminal take a look at cmder.

One solution for this is to install the latest conda, and then install all Python versions via conda envs. This will create separate folders for each Python version.

conda create -n python2.7 python=2.7 anaconda

For tox to find them you’ll need to:

  • add the main installation version to the systems PATH variable (e.g. D:\Anaconda - you can use WindowsPathEditor)

  • for other versions create a BAT scripts into the main installation folder to delegate the call to the correct Python interpreter:

    @echo off
    REM python2.7.bat
    @D:\Anaconda\pkgs\python-2.7.13-1\python.exe %*
    

This way you can also directly call from cli the matching Python version if you need to(similarly to UNIX systems), for example:

python2.7 main.py
python3.6 main.py