In Python, there is a testing framework called nose and it’s fairly easy to use.

$ pip install nose

Create a file and create a function with a name starting with test (for example test, testFoo, test_foo)

def test():
  x = 1
  assert x == 2

This test should fail. Run it

$ nosetests
FAIL: myfile.test
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/", line 197, in runTest
  File "/Users/ckim/lang/python/", line 3, in test
    assert x == 2

Ran 1 test in 0.002s

FAILED (failures=1)

A passing test looks like this:

$ nosetests
Ran 1 test in 0.000s


There is another package called sniffer

$ pip install sniffer

Depending on your operating system, you’ll want to download one of these file system checkers (otherwise it will poll your file system, which would be slower):

  • Linux: pyinotify
  • Windows: pywin32
  • Mac: MacFSEvents

By default sniffer will run a nose test, but it can be configured to run any other framework or run some custom code. Here’s how to run it with nose

$ sniffer -x

Whenever you change your code, the test will run and you can see the results immediately. The -x argument is passed to the testing framework (in this case nose).

If you want to read more, you can go to the github repository and read the README.rst