Skip to content

Instantly share code, notes, and snippets.

@RobinDavid
Created February 25, 2014 17:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinDavid/9213471 to your computer and use it in GitHub Desktop.
Save RobinDavid/9213471 to your computer and use it in GitHub Desktop.
Sample of a Pyunit test
import unittest
class Test1 (unittest.TestCase): #Define a class which extend unittest
def runTest(self):
self.failIf (1+1 != 2, '1+1 failed !')
def suite():
suite = unittest.TestSuite() #create an object testsuite
suite.addTest(Test1())
return suite
if __name__ == '__main__':
runner = unittest.TextTestRunner() #Declare the runner
test_suite = suite()
runner.run(test_suite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment