[Twisted-Python] trial (unit test) naming convention or obligation?
jml at mumak.net
Fri Mar 7 08:51:12 EST 2008
On Fri, Mar 7, 2008 at 1:44 PM, Gabriel Rossetti
<mailing_lists at evotex.ch> wrote:
> 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
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.
More information about the Twisted-Python