views:

408

answers:

4

I'm looking for a python project to use as example to copy the design of the unit test parts.

The project should have these features:

  1. its code is almost fully unit tested
  2. the code is distributed in many packages, there are more that one level of packages
  3. all the test can be run with a single command, for example with python test.py

I need that the project should use the same test convention for all the code contained. I saw the whole python project but the the various packages are tested with different conventions. For example the setuptools packages uses an ad hoc adaption of unittest library while the other packages doesn't.

I need that the project doesn't use a ad-hoc or a highly customized testing framework, because I want reuse its test architecture in my project.

+2  A: 

Maybe Nose itself?

PEZ
+1  A: 

Well, your specs point directly at a somewhat famous open source project, the Python Library. Have a look at python/trunk/Lib/test/regrtest.py, which will find all modules whose name is "test_*" in the test directory, and run them.

gimel
A: 

First, read about unittest. The documentation contains examples.

Second, since you want packages (not modules) the list is shorter. There are 15 packages in Python 2.5 distribution. Pick One At Random. Here's a subset that might meet some of your criteria.

  • bsddb: 7 modules - many test - test_all.py

  • ctypes: 4 modules - tests - runtests.py

  • distutils: many modules - tests - test_dist.py

  • email: many modules - tests - test_email.py

  • sqlite3 - 2 modules - tests - (not clear if there's an overall test, I got bored of looking)

S.Lott
+3  A: 

Django is a clean project that has a nice range of unit testing.

Have a look at how they propose you test your own projects.

Have a look at the unit testing code of the framework itself.

lpfavreau