#14378 closed (fixed)
Enable customization of the class for self.client in tests
Reported by: | Ned Batchelder | Owned by: | Ned Batchelder |
---|---|---|---|
Component: | Testing framework | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Ned Batchelder | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The attached patch removes the hard connection between test.TestCase and test.client.Client, instead making the class of client a class attribute on TestCase. This allows sub-classes of TestCase to specify a custom sub-class of Client to use in their tests.
While it's possible to create your own self.client in a setUp method, this keeps the code simpler. For example, I could set this class attribute once on my own base TestCase class, and all my test cases would use it without having to invoke setUp on the base class, just as the built-in TestCase class does.
Attachments (1)
Change History (6)
by , 14 years ago
Attachment: | custom-test-client.diff added |
---|
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 14 years ago
Cc: | added |
---|
comment:3 by , 14 years ago
milestone: | → 1.3 |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
Looks good to me. Thanks for the idea and patch, Ned.
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
the patch