第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

pytest的文件夾結構和導入問題

pytest的文件夾結構和導入問題

慕容3067478 2021-07-09 14:11:29
想象一個簡單的文件夾結構:my_folder/    __init__.py    funcs.py    tests/        test_funcs.py函數.py:def f():    return 2__init__.py:from funcs import ftest_funcs.py:from funcs import fdef test_f():    assert f() == 2這是文檔中建議的方法之一:https : //pytest.readthedocs.io/en/reorganize-docs/new-docs/user/directory_structure.html但是當我從my_folder以下位置運行 pytest 時:tests/test_funcs.py:1: in <module>    from funcs import fE   ModuleNotFoundError: No module named 'funcs'這很奇怪,因為我會認為它pytest設置了它運行的路徑,所以如果不手動處理它就不會出現(xiàn)這些類型的錯誤。文檔也沒有給出任何關于這一點的跡象......他們只是說:通常,您可以通過指向測試目錄或模塊來運行測試:pytest tests/test_appmodule.py      # for external test dirspytest src/tests/test_appmodule.py  # for inlined test dirspytest src                          # run tests in all below test directoriespytest                              # run all tests below current dir我錯過了什么?
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 293 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

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

公眾號

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