Before, the Flask app was launched from the views.py, which means the app's context lived in module (import calculator). However in nosetests, the context lived in the project directory (from calc import calculator).

I fixed this by starting the app within the project directory. I created a runserver.py file to launch the Flask app. I also initialize the Flask app in __init__.py which is convention.