unittest, order of test execution

Yinon Ehrlich yinon.me at gmail.com
Tue Jan 27 10:40:13 CET 2009


On Jan 27, 11:33 am, Yinon Ehrlich <yinon... at gmail.com> wrote:
> > But I was wondering, *should* this test be separated into two unit
> > tests, one for each function? On the face of it, it looks that's how it
> > should be done.
>
> > This, however, raises the question: what's the order of test execution
> > in the unittest? And how to pass values between unit tests? Should I
> > modify 'self' in unit test?
>
> It's OK to run some tests in the same function.
> When one of the asserts fails, following the traceback will lead you
> straight to your problem.
>
> The order of test execution is done by default by sorting the test
> functions alphabetically.
> You may disable the sort by setting self.sortTestMethodsUsing to None.
see: http://docs.python.org/library/unittest.html#unittest.TestLoader.sortTestMethodsUsing
> The simplest way to pass values between tests is to use the class it
> (self).
>
>   Yinon




More information about the Python-list mailing list