O'Reilly logo

Python Testing Beginner's Guide by Daniel Arbuckle

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

Time for action - organizing tests from previous chapters

We're going to take our tests from the previous chapters and organize them all into a tree of directories. Then we'll use Nose to run them all.

  1. Create a directory to hold our code and tests; you can choose any name for it, but I'll refer to it as project here.
  2. Put pid.py, operations.py and testable.py inside of project. When we run nosetests in the project directory, modules (and packages) stored in project will be accessible to all of the tests, no matter where the test is stored in the directory tree.
  3. Create a subdirectory called test_chapter2, and place the test.txt and test.py files from Chapter 2 in it.
  4. Create a subdirectory called test_chapter3, and place the final pid.txt file from ...

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