Tag Archives: case.py

Pytest executes the case.py file on the terminal error: Modulenotfounderror: no module named ‘API’

Use pytest to execute the case.py file on the terminal and report an error   Modulenotfounderror: no module named ‘API’. Actually, I have an API package,

The right-click run in pycharm can be executed.

In the first line of the case file to be executed (which must be the front of all references), add

import os,sys
sys.path.append(r"D:/python-workspace/interfacePytest") 

append followed by the absolute path to the project