亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何讓 PyTest 在 Github 中找到我的測試?

如何讓 PyTest 在 Github 中找到我的測試?

月關寶盒 2023-06-06 15:38:08
我有一個項目布局如下: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 找到它們。



查看完整回答
反對 回復 2023-06-06
  • 1 回答
  • 0 關注
  • 152 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號