Enable customization of the class for self.client in tests
|Reported by:||Ned Batchelder||Owned by:||Ned Batchelder|
|Cc:||Ned Batchelder||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
Change History (6)
comment:1 Changed 6 years ago by
|Owner:||changed from nobody to Ned Batchelder|
|Status:||new → assigned|