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 Darcs post-record hook

  1. Each local repository has its own set of hooks, so the first thing we need to do is create a repository. Make a directory to work in, and execute the following command in it:
    $ darcs initialize
    
    
  2. We need to put some test code in the repository directory so that Nose has something to do. Place the following (useless) code into a file called test_simple.py.
    from unittest import TestCase
    class test_simple(TestCase):
    def test_one(self):
    self.assertNotEqual("Testing", "Hooks")
    def test_two(self):
    self.assertEqual("Same", "Same")
    
  3. Run the following command to add the test file to the repository:
    $ darcs add test_simple.py
    
    
  4. Darcs hooks are identified using command line options. In this case, we ...

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