Edward d'Auvergne wrote:
> P.S. We still need to solve the problem of the relax module search
> path being missing when running individual unit tests.
>
Not a problem! The script unit_test_runner.py tmunges the class path
before unit tests are run so that the relax directory is in the
pythonpath
# add UnitTestDirectory to python path
backup_python_path = sys.path[:]
#sys.path.insert(1,unit_test_directory)
# add SystemDirectory to python path
sys.path.pop(0)
sys.path.insert(0,system_directory)
I wouldn't consider adding directories to 'sys.path' to be munging.
I've used a slightly different approach for the running of the
diffusion tensor data structure unit tests so that these can be run by
themselves. The file is
'test_suite/unit_tests/data/test_diff_tensor.py' and the code I have
used is (excluding the required import statements):
# Modify the system path so that the relax modules can be imported
(for stand alone execution).
path_comps = split(path[0], sep)
relax_path = sep + join(*path_comps[0:-3])
path.append(relax_path)
This simple code allows me to run these unit tests by themselves from
anywhere - which is very useful for debugging as the entire unit test
suite can be avoided. It would probably be worth either having this
code (or similar) at the start of each unit test module. Or we could
have the code spun out into it's own file and then imported by each
unit test module. What do you think?
Cheers,
Edward
.
Hi ed
You shouldn't need to do this path munging on a per test basis just
run unit_test_runner against a particular unit_test.py file or a
directory of unit tests and everyting should work
e.g.
./unit_test_runner.py data/test_diff_tensor.py
or in unit_tests
./unit_test_runner.py .
the unit test runner should do all the munging finding and loading for you
regards
gary
regards
gary
--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx Fax +44-113-2331407
-------------------------------------------------------------------