pytest和codecov:未找到覆盖率报告

问题描述 投票:1回答:1

我已经基于Cookie切割器模板创建了一个全新的Python repository。一切看起来都还不错,所以我现在尝试使用travis和codecov设置测试范围。我是pytest的新手,但我正在尝试做正确的事情。在互联网上浏览后,我完成了此设置:

.travis.yml中,我添加了以下内容:

.travis.yml

在我的install: - pip install -U tox-travis - pip install codecov script: - python setup.py install - tox - coverage run tests/tests.py 文件中:

tox.ini

我用以下命令创建了一个最小的tox.ini文件([testenv] passenv = CI TRAVIS TRAVIS_* setenv = PYTHONPATH = {toxinidir} PIPENV_IGNORE_VIRTUALENVS=1 deps = pipenv codecov pytest {py27}: pathlib2 commands_pre = pipenv install --dev --skip-lock codecov 是软件包中当前存在的唯一功能。

tests/tests.py

我有travis触发的codecov似乎没有通过测试。此外,在travis上,它说tests/tests.py😕我想知道我做错了什么吗?

python unit-testing code-coverage pytest travis-ci
1个回答
0
投票

好像您在安装中缺少foo()。您已经在脚本上安装了它,但是它可能没有运行。尝试在travis.yml文件中添加import pytest import doctest import neurokit2 as nk if __name__ == '__main__': doctest.testmod() pytest.main() def test_foo(): assert nk.foo() == 4 。也可以尝试一下:Error: No coverage report found

© www.soinside.com 2019 - 2024. All rights reserved.