SyFi  0.3
tests/sfc_commandline/test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import unittest
00004 import os, sys, glob, shutil, commands
00005 
00006 import SyFi
00007 import sfc
00008 
00009 _test_temp_dir = "temp_dir"
00010 class SFCCommandlineTest(unittest.TestCase):
00011     def setUp(self):
00012         print "Running templatetest in testdir"
00013         print "Imported SyFi from location", SyFi.__file__
00014         print "Imported sfc  from location", sfc.__file__
00015         shutil.rmtree(_test_temp_dir, ignore_errors=True)
00016         os.mkdir(_test_temp_dir)
00017         os.chdir(_test_temp_dir)
00018     
00019     def tearDown(self):
00020         os.chdir("..")
00021         #shutil.rmtree(_test_temp_dir, ignore_errors=True)
00022     
00023     def testForms(self):
00024         forms = glob.glob("../forms/*.form")
00025         for f in forms:
00026             #cmd = "sfc -o %s %s" % (_test_temp_dir, f)
00027             cmd = "sfc %s" % f
00028             status, output = commands.getstatusoutput(cmd)
00029             self.assertTrue(status == 0)
00030     
00031     #def testFailureExample(self):
00032     #    assert 1
00033     #    #assert 0 # uncomment to see how a failure looks like
00034 
00035 
00036 def test(verbosity=0):
00037     classes = [SFCCommandlineTest]
00038     suites = [unittest.makeSuite(c) for c in classes]
00039     testsuites = unittest.TestSuite(suites)
00040     unittest.TextTestRunner(verbosity=verbosity).run(testsuites)
00041 
00042 if __name__ == "__main__":
00043     test()
00044 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines