O'Reilly logo

Python Testing Cookbook by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating the project-level script to provide coverage reports

Update the project-level script to generate HTML, XML, and console coverage reports as runnable options.

Getting ready

  • Install coverage by typing pip install coverage.
  • Create the network management application as described in the Building a network management application section.

How to do it...

With these steps, we will explore how to use coverage programmatically in a project management script.

  1. Create a new file called recipe58.py to store this command-line script.
  2. Create a script that uses getopt to parse command-line arguments.
    import getopt import logging import nose import os import os.path import re import sys from glob import glob def usage(): print print "Usage: python recipe58.py ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required