Re: Test functions and test discovery

2006-06-14 Thread Ben Finney
bruno at modulix <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > (snip) > > if __name__ == "__main__": > > test_funcs = [x for name, x in globals() > > if name.startswith("test") and hasattr(x, "__call__") > > ] > > Any reason not to use callable(x) here ? (inste

Re: Test functions and test discovery

2006-06-14 Thread bruno at modulix
Ben Finney wrote: (snip) > if __name__ == "__main__": > test_funcs = [x for name, x in globals() > if name.startswith("test") and hasattr(x, "__call__") > ] Any reason not to use callable(x) here ? (instead of hasattr(x, "__call__")) -- bruno desthuilliers python

Test functions and test discovery (was: Re: Is there a better way of accessing functions in a module?)

2006-06-13 Thread Ben Finney
"Ant" <[EMAIL PROTECTED]> writes: > def a_test(): > print "Test A" > > def b_test(): > print "Test B" Incidentally, the convention is to name test functions as 'test_foo' not 'foo_test'; this will make your module more easily compatible with existing testing tools. > if __name__ == "__m