[Test] Fix some issues with PYTHONPATH

This commit is contained in:
Ray Speth 2013-12-09 01:36:03 +00:00
parent cf4ae23587
commit e7e5d739a1
4 changed files with 26 additions and 14 deletions

View file

@ -36,7 +36,9 @@ if strcmp(getenv('OS'), 'Windows_NT')
end end
% Set path to Python module % Set path to Python module
setenv('PYTHONPATH', fullfile(cantera_root, 'interfaces', 'python')) if strcmp(getenv('PYTHONPATH'), '')
setenv('PYTHONPATH', fullfile(cantera_root, 'build', 'python2'))
end
% A simple test to make sure that the ctmethods.mex file is present and working % A simple test to make sure that the ctmethods.mex file is present and working
f = Func('polynomial', 3, [1,2,3,4]); f = Func('polynomial', 3, [1,2,3,4]);

View file

@ -144,7 +144,7 @@ def regression_test(target, source, env):
with open(pjoin(dir,outputName), 'w') as outfile: with open(pjoin(dir,outputName), 'w') as outfile:
code = subprocess.call([program.abspath] + clopts + clargs, code = subprocess.call([program.abspath] + clopts + clargs,
stdout=outfile, stderr=outfile, stdout=outfile, stderr=outfile,
cwd=dir) cwd=dir, env=env['ENV'])
diff = 0 diff = 0
# Compare output files # Compare output files

View file

@ -9,15 +9,8 @@ localenv.Prepend(CPPPATH=['#ext/gtest/include', '#include'],
localenv.Append(LIBS=['gtest'] + localenv['cantera_libs'], localenv.Append(LIBS=['gtest'] + localenv['cantera_libs'],
CCFLAGS=env['warning_flags']) CCFLAGS=env['warning_flags'])
#localenv['ENV']['PYTHONPATH'] = Dir('#interfaces/python').abspath
localenv['ENV']['PYTHONPATH'] = Dir('#interfaces/python').abspath
localenv['ENV']['CANTERA_DATA'] = Dir('#build/data').abspath localenv['ENV']['CANTERA_DATA'] = Dir('#build/data').abspath
#print localenv.Dump()
print localenv['ENV']['PYTHONPATH']
#exit(0)
PASSED_FILES = {} PASSED_FILES = {}
# Needed for Intel runtime libraries when compiling with ICC # Needed for Intel runtime libraries when compiling with ICC
@ -105,7 +98,7 @@ def addTestScript(testname, subdir, script, interpreter, dependencies=(), env_va
return run_program return run_program
def addMatlabTest(script, testName, dependencies=None): def addMatlabTest(script, testName, dependencies=None, env_vars=()):
def matlabRunner(target, source, env): def matlabRunner(target, source, env):
passedFile = target[0] passedFile = target[0]
del testResults.tests[passedFile.name] del testResults.tests[passedFile.name]
@ -123,6 +116,7 @@ def addMatlabTest(script, testName, dependencies=None):
environ = dict(os.environ) environ = dict(os.environ)
environ.update(env['ENV']) environ.update(env['ENV'])
environ.update(env_vars)
code = subprocess.call([pjoin(env['matlab_path'], 'bin', 'matlab')] + code = subprocess.call([pjoin(env['matlab_path'], 'bin', 'matlab')] +
matlabOptions + ['-r', runCommand], matlabOptions + ['-r', runCommand],
env=environ, cwd=Dir('#test/matlab').abspath) env=environ, cwd=Dir('#test/matlab').abspath)
@ -175,13 +169,24 @@ if localenv['python3_package'] == 'y':
dependencies=(localenv['python3_module'] + dependencies=(localenv['python3_module'] +
localenv['python3_extension'] + localenv['python3_extension'] +
mglob(localenv, '#interfaces/cython/cantera/test', 'py')), mglob(localenv, '#interfaces/cython/cantera/test', 'py')),
env_vars={'PYTHONPATH':Dir('#build/python3').abspath}) env_vars={'PYTHONPATH':Dir('#build/python3').abspath,
'PYTHON_CMD': localenv.subst('$python3_cmd')})
localenv.Alias('test-cython3', pyTest) localenv.Alias('test-cython3', pyTest)
env['testNames'].append('cython3') env['testNames'].append('cython3')
if localenv['matlab_toolbox'] == 'y': if localenv['matlab_toolbox'] == 'y':
if localenv['python_package'] in ('full', 'minimal'):
env_vars = {'PYTHONPATH': Dir('#build/python2').abspath,
'PYTHON_CMD': localenv.subst('$python_cmd')}
elif localenv['python3_package'] == 'y':
env_vars = {'PYTHONPATH': Dir('#build/python3').abspath,
'PYTHON_CMD': localenv.subst('$python3_cmd')}
else:
env_vars = {} # ck2cti test is likely to fail
matlabTest = addMatlabTest('runCanteraTests.m', 'matlab', matlabTest = addMatlabTest('runCanteraTests.m', 'matlab',
dependencies=mglob(localenv, 'matlab', 'm')) dependencies=mglob(localenv, 'matlab', 'm'),
env_vars=env_vars)
localenv.Alias('test-matlab', matlabTest) localenv.Alias('test-matlab', matlabTest)
env['testNames'].append('matlab') env['testNames'].append('matlab')

View file

@ -5,9 +5,14 @@ localenv = env.Clone()
localenv.Prepend(CPPPATH=['#include', '#src', 'shared']) localenv.Prepend(CPPPATH=['#include', '#src', 'shared'])
localenv.Append(CCFLAGS=env['warning_flags']) localenv.Append(CCFLAGS=env['warning_flags'])
os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'interfaces', 'python') if localenv['python_package'] in ('full', 'minimal'):
localenv['ENV']['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'build', 'python2')
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python_cmd')
elif localenv['python3_package'] == 'y':
localenv['ENV']['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'build', 'python3')
localenv['ENV']['PYTHON_CMD'] = localenv.subst('$python3_cmd')
os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'build', 'data') localenv['ENV']['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'build', 'data')
PASSED_FILES = {} PASSED_FILES = {}