6

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

1 Answer 1

3

from app.sampling.filters import _private_function

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.