I have the following folder structure:
main.py
import pandas as pd
data = pd.read_csv('data.csv')
def add_num_to_env_num():
print("success")
test_main.py
import sys
sys.path.insert(1, '/src')
import src.main as main
def test_add_num_to_env_num():
main.add_num_to_env_num()
When I run command python -m pytest
I get the following error:
ERROR tests/test_main.py - FileNotFoundError: [Errno 2] No such file or directory: 'data.csv'
I hoped that the line: sys.path.insert(1, '/src')
will solve the issue but it didn't. How can I solve the issue?
EDIT: for the real use-case I cannot use absolute paths.