Here is the thing:
When you developing a project, and test the code, you don't want to copy the code to sys.path, I mean python site-packages.So you have to use relative import.
the structure is:
|- pymonitoringplusin
|- ftp_ftplib.py
|- tests
|- test_ftp.py
I want to import source code from develop path, not python site-packages.
Here is the code in test_ftp.py:
from ..pymonitoringplugins.ftp_ftplib.py import Ftp
But got error:
ValueError: Attempted relative import in non-package
Here is the source code:
Aucun commentaire:
Enregistrer un commentaire