Back to index

radiance  4R0+20100331
Functions | Variables
py_tests.unit_tools.support Namespace Reference

Functions

def _find_raydir
def binfile
def datafile
def run_case

Variables

tuple RAYDIR = _find_raydir()
tuple DATADIR = os.path.join(RAYDIR, 'test', 'test data')
tuple BINDIR = os.path.join(RAYDIR, 'bin')

Function Documentation

Definition at line 8 of file support.py.

00008 
00009 def _find_raydir():
00010        if __name__ == '__main__':
00011               thisfile = sys.argv[0]
00012        else: thisfile = sys.modules[__name__].__file__
00013        unit_tools = os.path.abspath(os.path.dirname(thisfile))
00014        py_tests = os.path.dirname(unit_tools)
00015        test = os.path.dirname(py_tests)
00016        raydir = os.path.dirname(test)
00017        return raydir

return the full path to file in bin dir

Definition at line 22 of file support.py.

00022 
00023 def binfile(fn):
00024        '''return the full path to file in bin dir'''
00025        if os.name == 'nt':
00026               return os.path.normpath(os.path.join(BINDIR, fn + '.exe'))
00027        else: return os.path.normpath(os.path.join(BINDIR, fn))

return the full path to file in data dir

Definition at line 28 of file support.py.

00028 
00029 def datafile(fn):
00030        '''return the full path to file in data dir'''
00031        return os.path.normpath(os.path.join(DATADIR, fn))

Definition at line 32 of file support.py.

00032 
00033 def run_case(c):
00034        res = unittest.TestResult()
00035        s = unittest.makeSuite(c, 'test')
00036        s.run(res)
00037        if res.errors or res.failures:
00038               print ' failed'
00039               print '-----------------------------'
00040               for e in res.errors:
00041                      print e[1]
00042               for e in res.failures:
00043                      es = string.strip(e[1])
00044                      sl = string.split(es, '\n')
00045                      print sl[-1]
00046               print '-----------------------------'
00047        else:
00048               print ' ok'
00049               

Variable Documentation

tuple py_tests.unit_tools.support.BINDIR = os.path.join(RAYDIR, 'bin')

Definition at line 20 of file support.py.

tuple py_tests.unit_tools.support.DATADIR = os.path.join(RAYDIR, 'test', 'test data')

Definition at line 19 of file support.py.

Definition at line 18 of file support.py.