#Is there an equivalent of PYTHONPATH? I would like to separate my test directory

7 messages · Page 1 of 1 (latest)

wicked elbow
#

I would like to setup my folder structure like this:

.
├── LICENSE
├── src
│   └── arrow.mojo
└── test
    └── test.mojo

2 directories, 3 files

However I can't seem to import arrow from test.mojo unless they are in the same directory. The error is cannot import relative to a top-level package

grave willow
#

Have you added __init__.mojo files into the src dir?

wicked elbow
#

Yup, and that gives the same error 😦

steel isleBOT
#

Congrats @wicked elbow, you just advanced to level 6!

signal badge
#

@wicked elbow I also have the same question. For now I am just maintaining a tests script within my mojo package. Then in a Makefile at my project root dir, I use the include arg:

mojo run -I . geo_features/test/main.mojo

wicked elbow
#

thanks! That's what I'm doing too