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

Nose and doctest

Nose doesn't just support doctest, it actually enhances it. When you're using Nose, you can write test fixtures for your doctest files.

If you pass --doctest-fixtures=_fixture on the command line, Nose will go looking for a fixture file whenever it finds a doctest file. The name of the fixture file is based on the name of the doctest file and is calculated by appending the doctest fixture suffix (in other words, the value of doctest-fixtures) to the main part of the doctest file name, and then adding .py to the end. For example, if Nose found a doctest file called pid.txt, and had been told that doctest‑fixtures=_fixture, it would try to find the test fixture in a file called pid_fixture.py.

The test fixture file for a doctest ...

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