ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/test/py_tests/unit_tools/support.py
(Generate patch)

Comparing ray/test/py_tests/unit_tools/support.py (file contents):
Revision 1.1 by schorsch, Sun Dec 7 20:40:51 2003 UTC vs.
Revision 1.2 by schorsch, Sun Jul 4 12:05:33 2004 UTC

# Line 1 | Line 1
1  
2   import os
3 + import sys
4   import string
5  
6   import unittest
7  
8   def _find_raydir():
9 <        try: thisfile = __file__
10 <        except NameError:
11 <                import support
12 <                thisfile = support.__file__
13 <        sdirn = string.count(thisfile, os.sep)
14 <        if sdirn in [0, 1]:
15 <                raydir = os.path.join('..','..')
15 <        elif sdirn == 2:
16 <                raydir = os.path.join('..')
17 <        elif sdirn == 3:
18 <                raydir = '.'
19 <        else:
20 <                unit_tools = os.path.split(thisfile)[0]
21 <                py_tests = os.path.split(unit_tools)[0]
22 <                test = os.path.split(py_tests)[0]
23 <                raydir = os.path.split(test)[0]
9 >        if __name__ == '__main__':
10 >                thisfile = sys.argv[0]
11 >        else: thisfile = sys.modules[__name__].__file__
12 >        unit_tools = os.path.abspath(os.path.dirname(thisfile))
13 >        py_tests = os.path.dirname(unit_tools)
14 >        test = os.path.dirname(py_tests)
15 >        raydir = os.path.dirname(test)
16          return raydir
17  
18   RAYDIR = _find_raydir()
# Line 28 | Line 20 | DATADIR = os.path.join(RAYDIR, 'test', 'test data')
20   BINDIR = os.path.join(RAYDIR, 'bin')
21  
22   def binfile(fn):
23 <        '''return the full/relative path to file in bin dir'''
23 >        '''return the full path to file in bin dir'''
24          if os.name == 'nt':
25                  return os.path.normpath(os.path.join(BINDIR, fn + '.exe'))
26          else: return os.path.normpath(os.path.join(BINDIR, fn))
27  
28   def datafile(fn):
29 <        '''return the full/relative path to file in data dir'''
29 >        '''return the full path to file in data dir'''
30          return os.path.normpath(os.path.join(DATADIR, fn))
31  
32   def run_case(c):

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)