I wrote my own module, let's call it mymodule
. To improve whether it's working I wrote tests
. So that's what the structure became:
django-mymodule
|-mymodule (.py files in here)
|-tests (.py files in here, they are unittests)
|-... (docs and this stuff)
When module
is installed to my computer is has to use relative imports like this: from . import otherfile
. When it is started as test, the imports have to look like this: import otherfile
.
So I will have to do something like this:
if is_run_as_test:
import otherfile
else:
from . import otherfile
How does this is_run_as_test
looks? Or am I doing something really wrong?