[Biopython-dev] Rethinking Biopython's testing framework

Michiel de Hoon mjldehoon at yahoo.com
Tue Dec 30 10:06:08 UTC 2008




--- On Sat, 12/27/08, Giovanni Marco Dall'Olio <dalloliogm at gmail.com> wrote:
> Basically, we will have to move every test in
> functions/classes with
> names beginning with 'test_'. To be more precise,
> they should match
> the regular expression '(?:^|[b_.-])[Tt]est' (it is
> also possible to
> coustomize this regex).
> 
> So, if a test now is it like this:
> 
> if __name__ == '__main__':
>     seq = Seq('sadasda')
>     assert seq.tostring() == 'sadasda'
> 
> we will have to refactor it like this:
> 
> def _test():
>     """test description"""
>     seq = Seq('sadasda')
>     assert seq.tostring() == 'sadasda'
> 
> if __name__ == '__main__':
>     _test()   # this is optional

Probably I don't quite understand how nose works, but if we refactor the code in this way, is that sufficient to enable users to use nose if they want to? If so, it may be possible to write the test scripts in a nose-compliant way as a courtesy to nose users. The only problem I can see with this is that it will be difficult to maintain. Basically every new test will have to be written in this nose-compliant way, and users are likely to be unaware of this.

--Michiel


      



More information about the Biopython-dev mailing list