我有一個項目布局如下: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
提交
取消