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 - 18:29:
Edward d'Auvergne wrote:

> 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



An alternative would be nice, which would use Gary's unit_test_runner infrastructure but retain the convention that unit test modules can be run with the simple command line syntax:

python ./test_my_function.py


Something like:

if __name__ == "__main__":
    from unit_test_runner import Run_unit_tests
    runner = Run_unit_tests(test_module=__file__, verbose=True)
    runner.run()

at the bottom of each unit test module should do it.


That sounds like a good solution which allows a different mode of
operation for the unit tests.  With the line:

#! /usr/bin/env python

at the start and with the executable bit turned on in the repository,
then in Posix systems you wouldn't even need to type python to run the
test.  Gary, what do you think?


exactly, thats good, though I can slim down the code to

if __name__ == "__main__":
from unit_test_runner import Run_unit_tests
Run_unit_tests(test_module=__file__, verbose=True)


;-)

regards
gary

Edward

.



--
-------------------------------------------------------------------
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 Wed Feb 28 13:00:39 2007