I'm using Python 3.8 with Azure functions. I have the following project layout ...
myproject
__app__
__init__.py
objects
__init__.py
tests
__init__.py
functions
__init__.py
objects
__init__.py
test_objects.py
My app/objects/init.py file starts like this ...
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
"""."""
...
And then my tests/functions/objects/init.py looks like
import pytest
import azure.functions as func
_import = __import__('__app__/objects')
def test_objects():
...
However, when I run
pytest tests/functions/test_objects.py
I get the error
tests/functions/test_objects.py:8: in <module>
_import = __import__('__app__/objects')
E ModuleNotFoundError: No module named '__app__/objects'
What's the right way to reference my function? I also tried just "objects", but that results in the same ModuleNotFoundError.