jeudi 24 mars 2016

Writing a foo package with unit testing in Python

I have been coding in Python for a few years now. I now want to write a "proper" package foo that will have the following "features":

  1. Can be installed by setuputils
  2. will contain sub packages bar, baz and foobar
  3. Each of the sub packages will contain classes (as opposed to free functions)
  4. The whole package can be unittested, as I develop it (i.e. using TDD)

So, in essence, what I'm asking is:

How can I use TDD to build a fully tested package containing sub packages?

Assuming the packages have the following classes:

foo/
   FooClass1:
        method1()
        method2()

   FooClass2
        method1()
        method2()

   /bar
   BarClass1
        method1()
        method2()

   BarClass2
        method1()
        method2()

   /baz
   BazClass1
        method1()
        method2()

   BazClass2
        method1()
        method2()

Can anyone provide guidlines (pref with sample code), on how to go about developing such a fully unit tested package?

I will be developing the package using Python 3.x

Aucun commentaire:

Enregistrer un commentaire