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 run this chapter's doctests

This recipe will help us explore building a project-level script that allows us to run different test suites. We will also focus on how to run it in our doctests.

How to do it...

With the following steps, we will craft a command-line script to allow us to manage a project including running doctests.

  1. Create a new file called recipe25.py to contain all the code for this recipe.
  2. Add code that parses a set of options using Python's getopt library.
    import getopt import glob import logging import nose import os import os.path import re import sys def usage(): print print "Usage: python recipe25.py [command]" print print "\t--help" print "\t--doctest" print "\t--suite [suite]" print "\t--debug-level ...

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