tox -- Command line driven CI frontend and development task automation tool.
tox
https://github.com/tox-dev/tox
Command line driven CI frontend and development task automation tool.
功能特性:
- 子任务环境隔离
- 自动化任务执行
- 构建
- 测试
- 发布
At its core tox provides a convenient way to run arbitrary commands in isolated environments to serve as a single entry point for build, test and release activities.
开源项目样例:
https://github.com/eightBEC/fastapi-ml-skeleton
How it works
https://tox.wiki/en/latest/index.html#
tox creates virtual environments for all configured so-called
testenvs, it then installs the project and other necessary dependencies and runs the configured set of commands. See system overview for more details.
使用tox后的优点
https://www.asapdevelopers.com/three-python-tools-automate-testing/#:~:text=Similarly%20to%20tox%2C%20Nox%20is%20a%20command-line%20tool,through%20a%20noxfile.py%20file%20within%20your%20project%E2%80%99s%20directory.
Multiple Python Version Example
https://christophergs.com/python/2020/04/12/python-tox-why-use-it-and-tutorial/#:~:text=%20tox%20makes%20it%20easy%20to%3A%20%201,not%20pass%20any%20evars%20from%20the...%20More%20
[tox] envlist = py37,py27 skipsdist = true [testenv] deps = pytest commands = pytest
Python Packaging Example
https://christophergs.com/python/2020/04/12/python-tox-why-use-it-and-tutorial/#packaging
If we decide to publish our squarer as a library (the world can’t live without this tool!), then we can unleash the full power
tox. If we turn to the “packaging” directory of the example repo, we find the following directory structure:└── packaging ├── setup.py ├── squarer │ ├── __init__.py │ ├── ml_squarer.py │ └── squarer.py ├── tests │ ├── __init__.py │ ├── test_ml_squarer.py │ └── test_squarer.py └── tox.ini
Alternative - Nox
https://nox.thea.codes/en/stable/index.html#:~:text=nox%20is%20a%20command-line%20tool%20that%20automates%20testing,via%20a%20noxfile.py%20file%20in%20your%20project%E2%80%99s%20directory.
https://zhuanlan.zhihu.com/p/102745306
noxis a command-line tool that automates testing in multiple Python environments, similar to tox. Unlike tox, Nox uses a standard Python file for configuration.Projects that use Nox
Nox is lucky to have several wonderful projects that use it and provide feedback and contributions.



浙公网安备 33010602011771号