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
我from mypkg.primes import is_prime
您停止修改sys.path
,它应该可以正常工作,而实际上是从包中from mypkg.primes import is_prime
: from 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.