ModuleNotFoundError: No module named 'function_app' while trying to unit test Python V2 Azure Functions

Clay Casper 166 Reputation points
2023-10-30T13:08:34.8766667+00:00

I'm trying to unit test my python v2 azure function. Here's some of the only documentation (https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Capplication-level&pivots=python-mode-decorators#unit-testing) I could find. I think it's either outdated or there is not enough context. For instance, when it says to import the main function from function_app, I tried doing that but got an import error. Specifically, ModuleNotFoundError: No module named 'function_app'. I tried adding init.py but that still didn't work.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,990 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.