pytest 的 PATH 問題“ImportError:沒有名為 YadaYadaYada 的模塊”

| | |

我使用 easy_install 在 Mac 上安裝 pytest,並開始為具有如下文件結構的項目編寫測試:

repo/repo/app.py repo/settings.py repo/ models.py repo/tests/repo/tests/test_app.py 

運行 py.test 而在 repo 目錄中,一切都如你所願 p>

但是當我在 linux 或 windows 上嘗試同樣的事情時(兩者都有 pytest 2.2.3),每當它從我的應用程序路徑中首次導入某些東西時,它都會吠叫。比如說 from app import some_def_in_app

我需要編輯我的 PATH 才能在這些系統上運行 py.test 嗎?有沒有人經歷過這個?

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method