简体   繁体   中英

pytest Interrupted: ImportError “No module named primes”

I have changed the sys.path to ../mypkg in the test_primes.py and it works when I execute it separately (without pytest) -

python test_primes.py

But, when I do

py.test

in the src, it doesn't work

PLEASE CHECK OUT THE IMAGE FOR THE DETAILED ERROR

pytest image

from mypkg.primes import is_prime您停止修改sys.path ,它应该可以正常工作,而实际上是从包中from mypkg.primes import is_primefrom mypkg.primes import is_prime

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM