equinor / komodoenv

Komodoenv is the virtualenv of the Komodo world
GNU General Public License v3.0
1 stars 3 forks source link

Add install_extra script for Komodo unit-test use #29

Closed pinkwah closed 2 years ago

pinkwah commented 3 years ago

The Komodo integration unit testing that we run on Jenkins uses komodoenv to set up an environment into which we can install testing dependencies such as pytest. A strong requirement is that this komodoenv doesn't actually install the given package's runtime requirements nor the package itself.

That is, in case of ecl, we want the tests of ecl to use the package as found in the komodo release that we're testing, rather than the one that could be potentially installed in komodoenv. We take care to only pip install -r test_requirements.txt, and hope that this file doesn't contain any runtime dependencies so that our tests don't pass accidentally when we forget to add some important package from setup.py into the komodo release.

The more modern and official way of handling test requirements is to add extras_require which allows us to pip install webviz-config[testing], thereby installing not only the webviz-config package but also all dependencies marked with testing.

It is currently not possible to ask pip to install only these extras. This install_extra script does allow this. The usage is as follows, which will install only the dependencies marked 'testing', and not webviz-config nor its runtime dependencies:

python -m komodoenv.scripts.install_extra webviz-config testing