擅长:python、mysql、java
<p>一种解决方案可能是在顶层创建一个名为<code>tox.ini</code>的文件,以便与tox一起使用。这是一个负责构建环境的工具—它类似于<code>make</code>,但更具体地说是python的东西。如果你做了一个<code>tox.ini</code>:</p>
<pre><code>[tox]
envlist = py
[testenv]
commands = pytest tests
deps =
pytest
</code></pre>
<p>然后用<code>pip3 install tox</code>安装<code>tox</code>,然后只使用命令行中的命令<code>tox</code>,它将负责在隔离的虚拟环境中安装包和运行测试。你知道吗</p>
<p>然后,您可以在<code>travis.yml</code>中执行此操作:</p>
<pre><code>language: python
python:
- 3.6
install:
- pip install tox
script:
- tox
</code></pre>
<p>Travis将使用<code>tox</code>以一种更具重现性的方式运行测试。你知道吗</p>