Comment 1 for bug 397428

Revision history for this message
John C Barstow (jbowtie) wrote :

I started to look at this.

quickly.tools calls exit(). So you can't write tests for quickly_name (for example...) because the tests never finish.

The individual commands seem to be scripts, so you can't import them without executing them! This makes testing hazardous at best.

The obvious thing to do here would be to encapsulate each command in a class, and to handle errors by throwing exceptions. That way you can at least get things into a test harness.

See django.core.management.base.BaseCommand for a much-easier-to-test example of defining custom commands in a testable manner. Even better, just copy the django-admin approach completely; it results in much more maintainable code. You can even steal their test harness.