Code

Opened 5 years ago

Closed 4 years ago

#12088 closed (duplicate)

Make the test Client class variable in TransactionTestCase

Reported by: obeattie 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: UI/UX:

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 obeattie 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by obeattie

comment:1 Changed 4 years ago by russellm

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 4 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.