16 |
|
import unittest |
17 |
|
|
18 |
|
SHORTPROGN = os.path.splitext(os.path.basename(sys.argv[0]))[0] |
19 |
< |
TESTCATS = ('cal','cv','gen','hd','meta','ot','px', 'rt','util',) |
19 |
> |
TESTCATS = ('pyrad','cal','cv','gen','hd','meta','ot','px', 'rt','util',) |
20 |
|
|
21 |
|
class Error(Exception): pass |
22 |
|
|
26 |
|
This class will create a virtual module "testsupport" with constants |
27 |
|
and functions for use in individual test cases. |
28 |
|
|
29 |
< |
testsupport.bindir - list of paths added to PATH |
30 |
< |
testsupport.path - complete list of paths currently in PATH |
31 |
< |
testsupport.radlib - list of paths added to RAYPATH |
32 |
< |
testsupport.raypath - complete list of paths currently in RAYPATH |
33 |
< |
testsupport.pyradlib - absolute path of python support library directory |
34 |
< |
testsupport.datadir - absolute path of test data directory |
35 |
< |
testsupport.datafile([sub, [sub,]] fn) - return absolute file path in |
29 |
> |
bindir - list of paths added to PATH |
30 |
> |
path - complete list of paths currently in PATH |
31 |
> |
radlib - list of paths added to RAYPATH |
32 |
> |
raypath - complete list of paths currently in RAYPATH |
33 |
> |
pyradlib - absolute path of python support library directory |
34 |
> |
datadir - absolute path of test data directory |
35 |
> |
datafile([sub, [sub,]] fn) - return absolute file path in |
36 |
|
data directory or in a subdirectory |
37 |
|
''' |
38 |
|
def __init__(self, **args): |
67 |
|
oldraypath = old_osenv.get('RAYPATH', '') |
68 |
|
raypathlist = oldraypath.split(os.pathsep) |
69 |
|
if self.radlib: |
70 |
< |
for rlib in self.radlib: |
70 |
> |
for rlib in self.radlib + ['.']: |
71 |
|
if rlib not in raypathlist: |
72 |
|
raypathlist.insert(0, rlib) |
73 |
|
os.environ['RAYPATH'] = os.pathsep.join(raypathlist) |
75 |
|
pyradlib = None |
76 |
|
for rp in raypathlist: |
77 |
|
prd = os.path.join(rp, 'pyradlib') |
78 |
– |
#print(prd) |
78 |
|
if os.path.isdir(prd) or os.path.islink(prd): |
80 |
– |
#print('--- found !!!') |
79 |
|
if rp not in sys.path: |
80 |
|
sys.path.insert(0, rp) |
81 |
|
pyradlib = prd |
115 |
|
fulldir = os.path.join(self.testdir, dir) |
116 |
|
if not os.path.isdir(fulldir): |
117 |
|
raise Error('No such directory: "%s"' % fulldir) |
118 |
< |
suite = loader.discover(fulldir, 'test*.py', |
118 |
> |
suite = loader.discover(fulldir, 'test_*.py', |
119 |
|
top_level_dir=self.thisdir) |
120 |
|
count = suite.countTestCases() |
121 |
|
if count: |