mailRe: builtins


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

Header


Content

Posted by Gary S. Thompson on February 27, 2007 - 12:17:
Gary S. Thompson wrote:

Gary S. Thompson wrote:

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



of course looking at my current code it doesn't do this currently in -f __name__=='__main__' but the gust are setup to be able to accept directories or single files and to do the right thing...


sorry I will restate it without typos (hopefully)

of course looking at my current code it doesn't currently look for files or directories from the command at the end of unit test runner where i test

if __name__=='__main__'

but the guts of the class are setup to be able to accept directories or single files from the command line and to do the right thing (and also of course the defaults also do the right thing ;-)...

More work needed! I guess I just remember doing more to the code than i did

regards
gary


regards gary



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
-------------------------------------------------------------------





Related Messages


Powered by MHonArc, Updated Tue Feb 27 12:40:29 2007