[英]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) - 我已经在../mypkg
中将sys.path
更改为../mypkg
,并且当我单独执行它(没有pytest)时它可以工作-
python test_primes.py python test_primes.py
But, when I do 但是,当我这样做
py.test py.test
in the src, it doesn't work 在src中,它不起作用
PLEASE CHECK OUT THE IMAGE FOR THE DETAILED ERROR 请检查图像中的详细错误
我from mypkg.primes import is_prime
您停止修改sys.path
,它应该可以正常工作,而实际上是从包中from mypkg.primes import is_prime
: from mypkg.primes import is_prime
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.