pytest local modules 1

pytest local modules

import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')

# from

Here is what the above code is Doing:
1. Get the directory of the current file.
2. Add the parent directory to the path.
3. Import the module.

This is a common pattern in Python.

Similar Posts