The Python project aims to test the compatibility of code with multiple Python versions using the tools tox, pyenv, and pytest.
Test the Python script for compatibility with versions 3.7, 3.8, 3.9, 3.10, and 3.11.
- install tox in the global environment
pip install tox
- install pytest in the global environment
pip install pytest
- install python versions
pyenv install 3.7
pyenv install 3.8
pyenv install 3.9
pyenv install 3.10
pyenv install 3.11
- run tox
tox run
Tox displays the issues in each file for each Python version: and then provides the most compatible Python versions at the end of the report.