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

Use pytest to execute the 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

append followed by the absolute path to the project

Similar Posts: