My code is organized this way:
app/sampling
├── __init__.py
├── filters.py
└── test
└── filters_test.py
On filters.py
there are some exported functions (included in __init__.py
) and some unexported functions, that begin with underscore.
On filters_test.py
I have no trouble testing the exported functions, that I can access like this:
from app.sampling import exported_function
(note that "app" is part of my PYTHONPATH)
But then if I try to import a private function like this:
from ..filters import _private_function
This seems to work but then on runtime:
SystemError: Parent module '' not loaded, cannot perform relative import
Additional notes:
- I'm using nose for running the tests
- I'd like to keep the folder structure if possible
Aucun commentaire:
Enregistrer un commentaire