ModuleNotFoundError inside a tests folder

60 Views Asked by At

Inside my tests directory, I have subtest_helpers.py and other test .py files. subtest_helpers.py has functions that I use within my test files. At the beginning of said test files, I have import subtest_helpers as sh but this gives me

nose2.loader.ModuleImportFailure
...
ModuleNotFoundError: No module named 'subtest_helpers'

I went into vscode, made a separate directory, and did a similar process. To my surprise, import file_1 as f1 works if I want to use functions from file_1 in file_2 and they are both in the same directory. So what am I doing wrong here? Not sure if it has to do with the fact that I am using nose2, a tests folder, or something completely different

0

There are 0 best solutions below