I have packaged my project using setup.py and project folder structure looks like below.
api-automation api packagename __init__.py user.py payloads a.json b.json tests conftest.py setup.cfg setup.py README.rst
I have created virtual environment in below folder with name "myenv_1", /Users/basavarajlamani/Documents/environments/ and i have installed above repo in this virtual environment.
I tried a lot on stackoverflow and internet but did not found answer.
code of user.py file
from pathlib import Path current_dir = str(Path(__file__).resolve().parent) def func(): print("current_dir", current_dir)
code of conftest.py
from packagename.user import func func()
If I run user.py file directly(python3 user.py), i will get the correct directory path as below,
But if I run conftest.py file(python3 conftest.py), I am getting installed path as below which i don't want and I want to get directory path like when i run user.py file directly,
Please help, how i can solve this problem.