When I try to run pytest locally for a Python project, I noticed that the import in those test scripts may fail if I run pytest in different directories. The import error usually means that your actual code modules is not in the python path, so they can not be imported successfully by your test scripts. This has something to do with how pytest set up the python path when you run it.