我有一个项目布局如下:ProjectRoot | \---------CoreImplelemntation | | | \--CoreSourceFile1.py | \--Test_CoreSourceFile1.py | \---------WebUIThatReferencesCoreImplentation | \--WebSourceFile1.py \--Test_WebSourceFile1.py我可以在本地运行(从项目的根文件夹)pipenv run pytest,我的所有测试都在这些子目录中被发现并执行。然而,当我尝试在 github 的工作流程中执行此操作时,以下所有情况都导致没有运行测试: - name: Test with pytest run: | pytest - name: Test with pytest run: | pipenv run pytest - name: Test with pytest run: | pipenv run pytest .每次输出看起来像这样:Run pipenv run pytest .Creating a virtualenv for this project...Pipfile: /home/runner/work/ed-scout/ed-scout/PipfileUsing /opt/hostedtoolcache/Python/3.7.8/x64/bin/python3.7m (3.7.8) to create virtualenv...created virtual environment CPython3.7.8.final.0-64 in 452ms creator CPython3Posix(dest=/home/runner/.local/share/virtualenvs/ed-scout-bRIm7jsM, clear=False, global=False) seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/home/runner/.local/share/virtualenv) added seed packages: pip==20.2.2, setuptools==49.6.0, wheel==0.35.1 activators PythonActivator,FishActivator,XonshActivator,CShellActivator,PowerShellActivator,BashActivatorSuccessfully created virtual environment!Virtualenv location: /home/runner/.local/share/virtualenvs/ed-scout-bRIm7jsM============================= test session starts ==============================platform linux -- Python 3.7.8, pytest-6.0.1, py-1.9.0, pluggy-0.13.1rootdir: /home/runner/work/ed-scout/ed-scoutcollected 0 items============================ no tests ran in 0.03s =============================##[error]Process completed with exit code 5.工作流文件如下:https ://github.com/joncage/ed-scout/pull/18/files是否有一些我缺少的魔法来让它运行或询问这里出了什么问题的方法?
1 回答
蓝山帝景
TA贡献1843条经验 获得超7个赞
原来我在 Windows 机器上本地运行我的测试,而 github 测试在 linux 下运行。PyTest 查找test...
文件并且我有Test...
文件,所以这是一个区分大小写的问题;重命名测试文件允许 PyTest 找到它们。
添加回答
举报
0/150
提交
取消