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 - installing Nose as a Mercurial post-commit hook

  1. We'll use the repository configuration file to store the hook, which means that the first thing we have to do is have a repository to work with. Make a new directory at a convenient place and execute the following command in it:
    $ hg init
    
    
  2. One side-effect of that command is that a .hg subdirectory got created. Change to that directory, and then create a text file called hgrc containing the following text:
    [hooks]
    commit = nosetests
    
  3. Back in the repository directory (i.e. the parent of the .hg directory), we need some tests for Nose to run. Create a file called test_simple.py containing the following (admittedly silly) tests:
    from unittest import TestCase class test_simple(TestCase): ...

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