[Twisted-Python] trial (unit test) naming convention or obligation?

Jonathan Lange jml at mumak.net
Fri Mar 7 06:51:12 MST 2008


On Fri, Mar 7, 2008 at 1:44 PM, Gabriel Rossetti
<mailing_lists at evotex.ch> wrote:
> Hello,
>
>  I am starting to use the trial package and while looking at some
>  examples I saw that some methods start with "test_" and some don't, so I
>  thought the test cases must start with that, then I noticed in another
>  file that camelCase was used, so what would have been "test_basic_op" in
>  one file would be "testBasicOp" in another. I just want to be sure as I
>  couldn't find any documentation other than "look at the code" (which I
>  have), and since I never actually found the parser : if a method starts
>  (contains it at the beginning) with the word "test", then the test suite
>  will execute it, if not, then it won't, correct?
>

The method must begin with 'test' in order to be found as a test by
Trial's test loader. This is the same as what unittest.TestLoader
does.

Twisted's internal convention is that methods intended to be found
dynamically should have the form '<prefix>_<camelCase>'. Sometimes we
are not so good at following our conventions.

jml




More information about the Twisted-Python mailing list