Tox:本地和 gitlab CI 运行期间的不同测试集
Tox: different test sets during local and gitlab CI runs
由于对本地 运行 服务的依赖,pytest 测试的一个子集不能 运行 在 gitlab 上。
如何将它们从 gitlab CI 管道中排除,同时保留它们用于本地测试?我不确定是否需要在 pytest、tox 或 gitlab config 中完成过滤。
当前配置:
tox.ini
[testenv]
commands = pytest {posargs}
gitlab-ci.yml
build:
stage: build
script:
- tox
最方便的方法是动态地通过 pytest
def test_function():
if not valid_config():
pytest.xfail("unsupported configuration")
您也可以使用两个不同的 tox.ini
文件。
虽然 tox
默认查找 tox.ini
,但您也可以传入单独的 tox.ini
文件,例如...
tox -c tox-ci.ini
由于对本地 运行 服务的依赖,pytest 测试的一个子集不能 运行 在 gitlab 上。 如何将它们从 gitlab CI 管道中排除,同时保留它们用于本地测试?我不确定是否需要在 pytest、tox 或 gitlab config 中完成过滤。
当前配置:
tox.ini
[testenv]
commands = pytest {posargs}
gitlab-ci.yml
build:
stage: build
script:
- tox
最方便的方法是动态地通过 pytest
def test_function():
if not valid_config():
pytest.xfail("unsupported configuration")
您也可以使用两个不同的 tox.ini
文件。
虽然 tox
默认查找 tox.ini
,但您也可以传入单独的 tox.ini
文件,例如...
tox -c tox-ci.ini