Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I automate testing of updated dependencies with Python?

Usually a python library depends on multiple other dependencies and it does specify these dependences using a range like foobar>=2.0.1

I am looking for a way to check if newer versions of the dependencies do introduce incompatibilities or not, and eventually to safe this information.

If they break something is very easy to ban those versions by adding something like !=2.0.2.

More difficile is to mark validations, like annotating the fact that it passed testing with a version.

Please note that I am looking for a way to automate this process. Also, note that upgrading dependencies to the latest version that passed the tests is not an acceptable option because it could introduce dependency deadlocks.

like image 355
sorin Avatar asked Sep 14 '25 16:09

sorin


1 Answers

I would suggest to use tox https://tox.readthedocs.io/en/latest/

tox can create multiple virtual envs to test with different dependencies

suppose you want to test the dependency foobar from version 1.0.0 till 2.0.0

You can define a 10 different test envs by using tox and just run tox to trigger 10 different tests run in 10 isolated env with foobar 1.0, foobar 1.1 till foobar 2.0

Please have a look at matrix of dependencies in tox

If it takes too much time to run 10 times tests suite in 10 isolated env, you maybe try to use detox, which can make efficient use of multiple CPUs by running all possible activities in parallel detox see https://github.com/tox-dev/detox

like image 154
milo Avatar answered Sep 16 '25 05:09

milo