I am feeling defeated by Python to the point where I am not sure what else to try. I am running Python 3.9 and I just cant for the life of me get the imports to work correctly. Here is my directory structure:
hello-world-proj
|
|.. core
|
|..
__init__.py
hello_world_main.py
|
|.. test
|
|..
__init__.py
test_hello_world_main.py
hello_world_main.py
def hello_world_main():
return "myString"
if __name__ == "__main__":
print(hello_world_main()) # call hello_world_main()
test_hello_world_main.py
import unittest
import os
from core import hello_world_main
class HelloWorldTest(unittest.TestCase):
self.assertEquals(hello_world_main(), "myString")
if __name__ == '__main__':
unittest.main(exit=False)
When I run python test_hello_world_main.py
I get hit with the error:
ImportError: cannot import name hello_world_main
I already did export PYTHONPATH=$PYTHONPATH:/path/to/hello-world-proj
I am defeated and no idea what to do now. Why is this happening?