Opened 15 years ago

Closed 14 years ago

#12088 closed (duplicate)

Make the test Client class variable in TransactionTestCase

Reported by: Oliver Beattie Owned by: nobody
Component: Testing framework Version: 1.1
Severity: Keywords: test, client
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I have a subclass of Django's TransactionTestCase, and I would also like to be able to specify my own subclass of Client to use as the test's client. However, at the moment, this requires me to basically copy-and-paste all of the code out of the TransactionTestCase's __call__ method, as the Client class is hard-coded into that function. This also makes the use of super on the subclasses' __call__ method impossible, as the client instance variable would just be reset to an instance of Client by TransactionTestCase.

If it were made to be a class variable, subclasses could easily change this without having to override the __call__ method. I've attached a diff proposal.

Attachments (1)

test_client.diff (746 bytes ) - added by Oliver Beattie 15 years ago.

Download all attachments as: .zip

Change History (3)

by Oliver Beattie, 15 years ago

Attachment: test_client.diff added

comment:1 by Russell Keith-Magee, 15 years ago

Has patch: set
Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

I'd rather see this as an overridable method on the class, rather than a class attribute.

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: duplicate
Status: newclosed

Marking as a duplicate of #14378 due to the availability of a full patch with tests and docs.

Note: See TracTickets for help on using tickets.
Back to Top