quickly needs tests
Bug #397428 reported by
Rick Spencer
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Quickly |
Fix Released
|
Medium
|
Michael Terry |
Bug Description
It's too easy to make modifications that break commands. We need unit testing for quickly itself.
Changed in quickly: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
assignee: | nobody → quickly developer team (quickly) |
Changed in quickly: | |
assignee: | quickly developers (quickly) → Michael Terry (mterry) |
Changed in quickly: | |
milestone: | none → 11.03.0 |
Changed in quickly: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
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.BaseComma nd 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.