News for hackers. Stuff that matters.
Re:Say “no” to import side‐effects in Python by ategra on Saturday April 05, 2014 @12:09PM (#7537431)
I'm on my mobile, so I can't paste code here. But the way I do it is to subclass the flask app and setup the routes in the setup method. Almost nothing happens on module scope. All views are defined in a seperate module using subclasses of flask views and they hold weak references to the app object. With this setup I neve had any problems testing individual modules. It also works together with flask's unit test client.

There are no comments on this comment yet.