Search code examples
pythontestingtox

How to test a library against different Python *patch* versions?


I'm writing a library and want to test against different Python patch versions, like 3.7.1, 3.7.2, etc

I've been using tox for a long time, however, according to this answer, it doesn't really support this kind of usage.

Any suggestions?


Solution

  • For a one of check against 3.8.1 (assuming your python3.8 points to 3.8.2) you can use the discover flag

    tox --discover /path/to/python3.8.1 -e py38
    

    If you want to define an environment that always uses 3.8.1 you can do that by defining a new tox environment and setting basepython as python3.8.1.

    [testenv:py381]
    basepython = python3.8.1
    
    [testenv:py382]
    basepython = python3.8.2