Overriding tox's install_command won't work for non-service projects

Stephen Finucane stephenfin at redhat.com
Tue Jan 10 14:06:45 UTC 2023


Another tox 4 PSA. It turns out the tox 3 was not using the command in '[tox]
install_command' when installing the package under test. tox 4 does, which means
overriding '[tox] install_command' to include a constraints file (-c) will
prevent you installing any requirement that is listed in the upper-constraints
file, even if said requirement is the thing you're currently working on. This
applies to all libraries (e.g. oslo.db, python-cinderclient) but not the
services (cinder, nova) since those aren't included in upper-constraints.

The "correct" way to respect upper-constraints is to provide them in 'deps'
alongside the requirements file(s), e.g.

  [testenv]
  deps =
    -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/test-requirements.txt

This will cause tox to install all of the package's dependencies first *with*
constraints before installing the package itself *without constraints*. There is
a bug report open against pip to change this behaviour [1], but it's been sat
there for over two years with no activity so I wouldn't rely on this.

Stephen

[1] https://github.com/pypa/pip/issues/7839




More information about the openstack-discuss mailing list