我是tox和GitHub操作的新手,我面临着一个问题。tox-testenv命令似乎不在自托管服务器上运行。这是将提交推送到github存储库的结果:
tox
...
___________________________________ summary ____________________________________
congratulations :)
然而,预期的结果应该是这样的:
tox
...
============================== 1 passed in 0.17s ==============================
___________________________________ summary ___________________________________
py310: commands succeeded
congratulations :)
我的tox.ini文件:
[tox]
minversion = 3.10
envlist = py310
isolated_build = true
[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
commands =
pytest --basetemp={envtmpdir}
github工作流文件
name: Tests
on:
- push
- pull_request
jobs:
test:
runs-on: self-hosted
strategy:
matrix:
python-version: ['3.10.6']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: |
tox
然而,上面的代码在GitHub托管的虚拟机上可以正常工作。(运行于:ubuntu最新(我的服务器运行在Ubuntu 20.04.4 LTS上。我做错了什么吗?我该怎么解决?
好的,我通过添加解决了这个问题
[gh-actions]
python =
3.10: py310
到tox.ini文件