python - 如何分析毒性?

标签 python profiling tox

我通过 tox 运行特定的测试用例:

tox -e myenv foo.tests.test_foo.SomeTestCase

这需要 30 秒。

测试本身非常简单且快速。但在这之前似乎发生了很多事情 测试开始运行。

如何跟踪/分析测试运行之前发生的事情?

我想仅分析 tox 不会有帮助,因为 tox 的作用不大。 Tox 会产生耗时过长的子进程。

最佳答案

tox 4当通过两级详细级别时,打印出时间戳。所以我的建议是安装 tox 4 然后执行 tox -vvv r -e myenv --foo.tests.test_foo.SomeTestC .

PS。您可以做的一个可能的大工作是在 sdist 构建上启用 Wheel 构建(仅在 tox 4 中支持),因为由于需要设置隔离的构建环境,目前使用 pip 安装 sdist 非常昂贵:

[testenv]
package = wheel
# below settings only applies if you don't have a c extension
wheel_build_env = .pkg
PS。我是毒物作者/维护者。

关于python - 如何分析毒性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69492096/

相关文章:

r - profvis() 何时以及为何显示 "Sources not available"?

c++ - gprof 和 eclipse 错误

python - 如何计算全局覆盖率?

python - pyenv 安装多个 python,但只识别一些

python - Pandas : How to avoid fillna while resampling from hourly to daily data

python - 创建子列表时填充

python - 为 Flask 应用程序创建系统服务时如何解决 (code=exited,status=203/Exec)

python - Flask,将表单中的数据保存到json文件

c++ - 使用 Visual Studio 进行分析,在函数的右括号或左括号上包含较大的包含样本百分比? C++

pytest - 所有环境的 tox 默认依赖项