mailRe: builtins


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on February 27, 2007 - 04:28:
> 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



Related Messages


Powered by MHonArc, Updated Tue Feb 27 10:40:30 2007