From the pip docs:
pip’s command line options can be set with environment variables using the format PIP_<UPPER_LONG_NAME> . Dashes (-) have to be replaced with underscores (_).
Source: https://pip.pypa.io/en/stable/user_guide/#environment-variables
This translates into setting the following environment variables:
PIP_INDEX_URL=https://server1/pypi/simple
PIP_EXTRA_INDEX_URL=https://server2/pypi/simple
So, with tox, you can e.g. set:
[testenv]
setenv =
PIP_INDEX_URL=https://server1/pypi/simple
PIP_EXTRA_INDEX_URL=https://server2/pypi/simple
However, you can only specify one extra index url with PIP_EXTRA_INDEX_URL. If you need multiple ones, pip recommends appending multiple --extra-index-url <URL>
after the pip command so if you need more than one extra index URL, you could possibly utilize tox's install_command
:
[testenv]
install_command =
python -m pip install {opts} {packages} --extra-index-url <URL1> --extra-index-url <URL2>