Running Python unittests from Command Line

This script will allow a Python unittest to be run from the command line.

import unittest
import testFile
suite = unittest.TestLoader().loadTestsFromModule(testFile)
unittest.TextTestRunner().run(suite)

testFile.py

import unittest
from fun import add

class test_function(unittest.TestCase):
     def test_one(self):
           result = add(2,3)
           self.assertEquals(result, 5)

fun.py

def add(a,b):
     return a+b