1

I'm working on a monolithic legacy web application, which we want to try and dismantle. I want to figure out what parts of the code are never run. Is it possible to run uwsgi with coverage, and if yes, how do I go about it?

zsquare
  • 9,916
  • 6
  • 53
  • 87
  • Have you read the documentation? Might reveal something: http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html http://nedbatchelder.com/code/coverage/ – Joe Smart Sep 02 '14 at 13:58
  • You can use the unit testing support from Flask to get useful coverage reports: http://flask.pocoo.org/docs/0.10/testing/ The "Flask Mega Tutorial" explains how to set up coverage reports here: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling – Aaron Digulla Sep 02 '14 at 14:03

1 Answers1

1

Python coverage has an API. Have a look at the docs.

You should be able to do cov.start() before the app construction. How to stop it and make a report may be a bit harder... Maybe you can register an atexit handler?

viraptor
  • 33,322
  • 10
  • 107
  • 191